From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:53212 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbZBTFnL (ORCPT ); Fri, 20 Feb 2009 00:43:11 -0500 From: "Luis R. Rodriguez" To: linville@tuxdriver.com, johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, "Luis R. Rodriguez" Subject: [PATCH v5 09/15] cfg80211: protect first access of last_request on 11d hint under mutex Date: Fri, 20 Feb 2009 00:42:44 -0500 Message-Id: <1235108570-17652-10-git-send-email-lrodriguez@atheros.com> (sfid-20090220_064316_943169_A42BACFA) In-Reply-To: <1235108570-17652-1-git-send-email-lrodriguez@atheros.com> References: <1235108570-17652-1-git-send-email-lrodriguez@atheros.com> Sender: linux-wireless-owner@vger.kernel.org List-ID: We were not protecting last_request there is a small possible race between an 11d hint and another routine which calls reset_regdomains() which can prevent a valid country IE from being processed. This is not critical as it will still be procesed soon after but locking prior to it is correct. Signed-off-by: Luis R. Rodriguez --- net/wireless/reg.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index d44f3b5..b474452 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -1261,11 +1261,13 @@ void regulatory_hint_11d(struct wiphy *wiphy, u32 checksum = 0; enum environment_cap env = ENVIRON_ANY; - if (!last_request) - return; - mutex_lock(&cfg80211_mutex); + if (unlikely(!last_request)) { + mutex_unlock(&cfg80211_mutex); + return; + } + /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) goto out; -- 1.6.0.3