From: Luis R. Rodriguez Date: Sat, 21 Feb 2009 05:04:27 +0000 (-0500) Subject: cfg80211: protect first access of last_request on 11d hint under mutex X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d335fe6391c2d86582cf71ef5773a161ee604608;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git cfg80211: protect first access of last_request on 11d hint under mutex 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 Signed-off-by: John W. Linville --- diff --git a/net/wireless/reg.c b/net/wireless/reg.c index d44f3b5481ad..b47445219a48 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;