diff options
author | Giovanni Cabiddu | 2023-09-14 10:55:48 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-11-20 11:52:05 +0100 |
commit | dc44e3fdb091c157fb68cdb9be10c43798b6f16d (patch) | |
tree | 21aaa659cecf9f20a96734797470d951cd1a0a87 /drivers/scsi | |
parent | 5e989aeb40220e90c48b2d2e6352b19d9cd151c4 (diff) |
crypto: qat - fix unregistration of crypto algorithms
[ Upstream commit 9b2f33a1bfcda90b857431a764c9c8f9a412bbe5 ]
The function adf_dev_init(), through the subsystem qat_crypto, populates
the list of list of crypto instances accel_dev->crypto_list.
If the list of instances is not empty, the function adf_dev_start() will
then call qat_algs_registers() and qat_asym_algs_register() to register
the crypto algorithms into the crypto framework.
If any of the functions in adf_dev_start() fail, the caller of such
function, in the error path calls adf_dev_down() which in turn call
adf_dev_stop() and adf_dev_shutdown(), see for example the function
state_store in adf_sriov.c.
However, if the registration of crypto algorithms is not done,
adf_dev_stop() will try to unregister the algorithms regardless.
This might cause the counter active_devs in qat_algs.c and
qat_asym_algs.c to get to a negative value.
Add a new state, ADF_STATUS_CRYPTO_ALGS_REGISTERED, which tracks if the
crypto algorithms are registered into the crypto framework. Then use
this to unregister the algorithms if such flag is set. This ensures that
the crypto algorithms are only unregistered if previously registered.
Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework")
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Adam Guerin <adam.guerin@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/scsi')
0 files changed, 0 insertions, 0 deletions