Commit 487caa8d authored by Damian Muszynski's avatar Damian Muszynski Committed by Herbert Xu

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: d9fb8408 ("crypto: qat - add rate limiting feature to qat_4xxx")
Signed-off-by: default avatarDamian Muszynski <damian.muszynski@intel.com>
Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6627f03c
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment