[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1519831218.631518194@decadent.org.uk>
Date: Wed, 28 Feb 2018 15:20:18 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org,
"Dominik Brodowski" <linux@...inikbrodowski.net>,
"Johannes Berg" <johannes.berg@...el.com>
Subject: [PATCH 3.16 205/254] nl80211: take RCU read lock when calling
ieee80211_bss_get_ie()
3.16.55-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dominik Brodowski <linux@...inikbrodowski.net>
commit 7a94b8c2eee7083ddccd0515830f8c81a8e44b1a upstream.
As ieee80211_bss_get_ie() derefences an RCU to return ssid_ie, both
the call to this function and any operation on this variable need
protection by the RCU read lock.
Fixes: 44905265bc15 ("nl80211: don't expose wdev->ssid for most interfaces")
Signed-off-by: Dominik Brodowski <linux@...inikbrodowski.net>
Signed-off-by: Johannes Berg <johannes.berg@...el.com>
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
net/wireless/nl80211.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2354,12 +2354,13 @@ static int nl80211_send_iface(struct sk_
const u8 *ssid_ie;
if (!wdev->current_bss)
break;
+ rcu_read_lock();
ssid_ie = ieee80211_bss_get_ie(&wdev->current_bss->pub,
WLAN_EID_SSID);
- if (!ssid_ie)
- break;
- if (nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2))
- goto nla_put_failure_locked;
+ if (ssid_ie &&
+ nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2))
+ goto nla_put_failure_rcu_locked;
+ rcu_read_unlock();
break;
}
default:
@@ -2370,6 +2371,8 @@ static int nl80211_send_iface(struct sk_
return genlmsg_end(msg, hdr);
+ nla_put_failure_rcu_locked:
+ rcu_read_unlock();
nla_put_failure_locked:
wdev_unlock(wdev);
nla_put_failure:
Powered by blists - more mailing lists