mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: madhuparnabhowmik10@gmail.com
To: johannes@sipsolutions.net, davem@davemloft.net, kuba@kernel.org
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, frextrite@gmail.com,
	joel@joelfernandes.org, paulmck@kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Subject: [PATCH 1/4] net: mac80211: util.c: Fix RCU list usage warnings
Date: Thu,  9 Apr 2020 13:58:22 +0530	[thread overview]
Message-ID: <20200409082822.27314-1-madhuparnabhowmik10@gmail.com> (raw)

From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

This patch fixes the following warning (CONIG_PROVE_RCU_LIST)
in ieee80211_check_combinations().

WARNING: suspicious RCU usage
[   80.933723] 5.6.0+ #4 Not tainted
[   80.933733] -----------------------------
[   80.933746] net/mac80211/util.c:3934 RCU-list traversed in non-reader section!!

Also, fix the other uses of list_for_each_entry_rcu() by either using
list_for_each_entry() instead (When mutex or spinlock is always held
in the function) or pass the necessary lockdep condition.

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
---
 net/mac80211/util.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 20436c86b9bf..f4b0434024c0 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -254,7 +254,7 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
 
 	sdata->vif.txqs_stopped[ac] = false;
 
-	list_for_each_entry_rcu(sta, &local->sta_list, list) {
+	list_for_each_entry(sta, &local->sta_list, list) {
 		if (sdata != sta->sdata)
 			continue;
 
@@ -719,7 +719,8 @@ static void __iterate_interfaces(struct ieee80211_local *local,
 	struct ieee80211_sub_if_data *sdata;
 	bool active_only = iter_flags & IEEE80211_IFACE_ITER_ACTIVE;
 
-	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+	list_for_each_entry_rcu(sdata, &local->interfaces, list,
+				(lockdep_is_held(&local->iflist_mtx)|| lockdep_rtnl_is_held())) {
 		switch (sdata->vif.type) {
 		case NL80211_IFTYPE_MONITOR:
 			if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE))
@@ -3931,7 +3932,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
 		params.num_different_channels++;
 	}
 
-	list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) {
+	list_for_each_entry(sdata_iter, &local->interfaces, list) {
 		struct wireless_dev *wdev_iter;
 
 		wdev_iter = &sdata_iter->wdev;
@@ -3982,7 +3983,7 @@ int ieee80211_max_num_channels(struct ieee80211_local *local)
 			ieee80211_chanctx_radar_detect(local, ctx);
 	}
 
-	list_for_each_entry_rcu(sdata, &local->interfaces, list)
+	list_for_each_entry(sdata, &local->interfaces, list)
 		params.iftype_num[sdata->wdev.iftype]++;
 
 	err = cfg80211_iter_combinations(local->hw.wiphy, &params,
-- 
2.17.1


             reply	other threads:[~2020-04-09  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09  8:28 madhuparnabhowmik10 [this message]
2020-04-24  9:18 ` 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=20200409082822.27314-1-madhuparnabhowmik10@gmail.com \
    --to=madhuparnabhowmik10@gmail.com \
    --cc=davem@davemloft.net \
    --cc=frextrite@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@kernel.org \
    /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

all inboxes | Powered by JetHome®