diff mbox

crypto: qat - initialize cra_flags before register into kpp

Message ID 20161222150051.6284-1-giovanni.cabiddu@intel.com (mailing list archive)
State Changes Requested
Delegated to: Herbert Xu
Headers show

Commit Message

Cabiddu, Giovanni Dec. 22, 2016, 3 p.m. UTC
Initialize dh.base.cra_flags before registering the dh algorithm.
Without this fix, the registration of the dh algorithm might fail
if the qat driver is restarted.

Signed-off-by: Sushil Kumar <sushilx.kumar@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
---
 drivers/crypto/qat/qat_common/qat_asym_algs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Herbert Xu Dec. 28, 2016, 10:12 a.m. UTC | #1
On Thu, Dec 22, 2016 at 03:00:51PM +0000, Giovanni Cabiddu wrote:
> Initialize dh.base.cra_flags before registering the dh algorithm.
> Without this fix, the registration of the dh algorithm might fail
> if the qat driver is restarted.
> 
> Signed-off-by: Sushil Kumar <sushilx.kumar@intel.com>
> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

Please patch the crypto API instead.  I think unsetting the bit
CRYPTO_ALG_DEAD at the top of crypto_register_alg should do the
trick.

Thanks,
diff mbox

Patch

diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c
index 0d35dca..d3518e6 100644
--- a/drivers/crypto/qat/qat_common/qat_asym_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c
@@ -1343,6 +1343,7 @@  int qat_asym_algs_register(void)
 		ret = crypto_register_akcipher(&rsa);
 		if (ret)
 			goto unlock;
+		dh.base.cra_flags = 0;
 		ret = crypto_register_kpp(&dh);
 	}
 unlock: