crypto: algapi - enforce that all instances have a ->free() method
[linux-2.6-block.git] / crypto / skcipher.c
index 42add1e0814ffa5bec1329ea130cef9c1d6a57aa..7221def7b9a7ff4bd2b3a96d53b162cd8d10d5bf 100644 (file)
@@ -865,6 +865,9 @@ int skcipher_register_instance(struct crypto_template *tmpl,
 {
        int err;
 
+       if (WARN_ON(!inst->free))
+               return -EINVAL;
+
        err = skcipher_prepare_alg(&inst->alg);
        if (err)
                return err;