Skip to content

Commit 487caa8

Browse files
dmuszynsherbertx
authored andcommitted
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: d9fb840 ("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>
1 parent 6627f03 commit 487caa8

File tree

1 file changed

+2
-2
lines changed
  • drivers/crypto/intel/qat/qat_common

1 file changed

+2
-2
lines changed

drivers/crypto/intel/qat/qat_common/adf_rl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,13 +815,13 @@ static int add_update_sla(struct adf_accel_dev *accel_dev,
815815
return -EFAULT;
816816
}
817817

818+
mutex_lock(&rl_data->rl_lock);
819+
818820
/* Input validation */
819821
ret = validate_user_input(accel_dev, sla_in, is_update);
820822
if (ret)
821823
goto ret_err;
822824

823-
mutex_lock(&rl_data->rl_lock);
824-
825825
if (is_update) {
826826
ret = validate_sla_id(accel_dev, sla_in->sla_id);
827827
if (ret)

0 commit comments

Comments
 (0)