netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: johannes.berg@intel.com
Cc: regressions@leemhuis.info, netdev@vger.kernel.org,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] nl80211: take RCU read lock when calling ieee80211_bss_get_ie()
Date: Sun, 14 Jan 2018 19:03:38 +0100	[thread overview]
Message-ID: <20180114180338.GA1569@light.dominikbrodowski.net> (raw)
In-Reply-To: <20180108100403.GA4715@light.dominikbrodowski.net>

As ieee80211_bss_get_ie() derefences an RCU, it needs to be called with
rcu_read_lock held.

Fixes: 44905265bc15 ("nl80211: don't expose wdev->ssid for most interfaces")
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---

This patch fixes the regression I reported in the last couple of weeks for
various v4.15-rcX revisions to netdev, where a "suspicious RCU usage"
showed up in net/wireless/util.c:778.

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 2b3dbcd40e46..1eecc249fb5e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2618,8 +2618,10 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
 		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);
+		rcu_read_unlock();
 		if (!ssid_ie)
 			break;
 		if (nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2))

  reply	other threads:[~2018-01-14 18:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22  7:20 suspicious RCU usage in net/wireless/util.c:778 Dominik Brodowski
2017-12-30 13:11 ` v4.15-rc5 warning: " Dominik Brodowski
2018-01-08 10:04   ` v4.15-rc7 regression/warning: " Dominik Brodowski
2018-01-14 18:03     ` Dominik Brodowski [this message]
2018-01-14 21:58       ` [PATCH] nl80211: take RCU read lock when calling ieee80211_bss_get_ie() Johannes Berg
2018-01-14 22:22         ` [PATCH v2] " Dominik Brodowski
2018-01-14 22:40           ` Johannes Berg
2018-01-15  7:12             ` [PATCH v3] " Dominik Brodowski
2018-01-15  8:15               ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180114180338.GA1569@light.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=regressions@leemhuis.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).