From: Alexey Khoroshilov Date: Tue, 23 Aug 2011 20:44:32 +0000 (+0400) Subject: carl9170: Fix mismatch in carl9170_op_set_key mutex lock-unlock X-Git-Tag: v3.0.5~210 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8a9f335df5baa97f3901378335ff10f3fecf36de;p=karo-tx-linux.git carl9170: Fix mismatch in carl9170_op_set_key mutex lock-unlock commit 66cb54bd24086b2d871a03035de9b0e79b2b725e upstream. If is_main_vif(ar, vif) reports that we have to fall back to software encryption, we goto err_softw; before locking ar->mutex. As a result, we have unprotected call to carl9170_set_operating_mode and unmatched mutex_unlock. The patch fix the issue by adding mutex_lock before goto. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Acked-By: Christian Lamparter Signed-off-by: John W. Linville Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 54d093c2ab44..b54966c1dcf2 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -1066,8 +1066,10 @@ static int carl9170_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, * the high througput speed in 802.11n networks. */ - if (!is_main_vif(ar, vif)) + if (!is_main_vif(ar, vif)) { + mutex_lock(&ar->mutex); goto err_softw; + } /* * While the hardware supports *catch-all* key, for offloading