From patchwork Tue Aug 23 20:44:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Khoroshilov X-Patchwork-Id: 1089932 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7NLFCrZ007546 for ; Tue, 23 Aug 2011 21:15:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753108Ab1HWVPJ (ORCPT ); Tue, 23 Aug 2011 17:15:09 -0400 Received: from smtp.ispras.ru ([83.149.198.202]:49354 "EHLO smtp.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755279Ab1HWVPI (ORCPT ); Tue, 23 Aug 2011 17:15:08 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 23 Aug 2011 21:15:12 +0000 (UTC) X-Greylist: delayed 1810 seconds by postgrey-1.27 at vger.kernel.org; Tue, 23 Aug 2011 17:15:08 EDT Received: from hednb.ispras.ru (winnie.ispras.ru [83.149.198.236]) by smtp.ispras.ru (Postfix) with ESMTP id 66B195D403C; Wed, 24 Aug 2011 00:34:37 +0400 (MSD) From: Alexey Khoroshilov To: Christian Lamparter Cc: Alexey Khoroshilov , "John W. Linville" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@ispras.ru Subject: [PATCH] carl9170: Fix mismatch in carl9170_op_set_key mutex lock-unlock Date: Wed, 24 Aug 2011 00:44:32 +0400 Message-Id: <1314132272-7357-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 1.7.4.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- drivers/net/wireless/ath/carl9170/main.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 0122930..0474e663 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