crypto: qat - fix mutex ordering in adf_rl

If the function validate_user_input() returns an error, the error path
attempts to unlock an unacquired mutex.
Acquire the mutex before calling validate_user_input(). This is not
strictly necessary but simplifies the code.

Fixes: d9fb8408376e ("crypto: qat - add rate limiting feature to qat_4xxx")
Signed-off-by: Damian Muszynski <damian.muszynski@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Damian Muszynski 2023-11-28 18:39:30 +01:00 committed by Herbert Xu
parent 6627f03c21
commit 487caa8d5e

View File

@ -815,13 +815,13 @@ static int add_update_sla(struct adf_accel_dev *accel_dev,
return -EFAULT;
}
mutex_lock(&rl_data->rl_lock);
/* Input validation */
ret = validate_user_input(accel_dev, sla_in, is_update);
if (ret)
goto ret_err;
mutex_lock(&rl_data->rl_lock);
if (is_update) {
ret = validate_sla_id(accel_dev, sla_in->sla_id);
if (ret)