Merge tag 'for-5.6/io_uring-vfs-2020-01-29' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / crypto / akcipher.c
index 7d5cf49..f866085 100644 (file)
@@ -90,11 +90,12 @@ static const struct crypto_type crypto_akcipher_type = {
        .tfmsize = offsetof(struct crypto_akcipher, base),
 };
 
-int crypto_grab_akcipher(struct crypto_akcipher_spawn *spawn, const char *name,
-                        u32 type, u32 mask)
+int crypto_grab_akcipher(struct crypto_akcipher_spawn *spawn,
+                        struct crypto_instance *inst,
+                        const char *name, u32 type, u32 mask)
 {
        spawn->base.frontend = &crypto_akcipher_type;
-       return crypto_grab_spawn(&spawn->base, name, type, mask);
+       return crypto_grab_spawn(&spawn->base, inst, name, type, mask);
 }
 EXPORT_SYMBOL_GPL(crypto_grab_akcipher);
 
@@ -146,6 +147,8 @@ EXPORT_SYMBOL_GPL(crypto_unregister_akcipher);
 int akcipher_register_instance(struct crypto_template *tmpl,
                               struct akcipher_instance *inst)
 {
+       if (WARN_ON(!inst->free))
+               return -EINVAL;
        akcipher_prepare_alg(&inst->alg);
        return crypto_register_instance(tmpl, akcipher_crypto_instance(inst));
 }