mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Hanne-Lotta Mäenpää" <hannelotta@gmail.com>
To: stable@vger.kernel.org
Cc: johannes@sipsolutions.net, shaul.triebitz@intel.com,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev, skhan@linuxfoundation.org,
	david.hunter.linux@gmail.com,
	"Benjamin Berg" <benjamin.berg@intel.com>,
	"Gregory Greenman" <gregory.greenman@intel.com>,
	"Johannes Berg" <johannes.berg@intel.com>,
	"Hanne-Lotta Mäenpää" <hannelotta@gmail.com>
Subject: [PATCH 6.1.y 1/2] wifi: mac80211: avoid lockdep checking when removing deflink
Date: Sat, 23 Aug 2025 23:22:07 +0300	[thread overview]
Message-ID: <20250823202208.43086-1-hannelotta@gmail.com> (raw)

From: Benjamin Berg <benjamin.berg@intel.com>

struct sta_info may be removed without holding sta_mtx if it has not
yet been inserted. To support this, only assert that the lock is held
for links other than the deflink.

This fixes lockdep issues that may be triggered in error cases.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.cdd81377dea0.If5a6734b4b85608a2275a09b4f99b5564d82997f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit b8b80770b26c4591f20f1cde3328e5f1489c4488)
Signed-off-by: Hanne-Lotta Mäenpää <hannelotta@gmail.com>
---
 net/mac80211/sta_info.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index dd1864f6549f..e9ae92094794 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -357,8 +357,9 @@ static void sta_remove_link(struct sta_info *sta, unsigned int link_id,
 	struct sta_link_alloc *alloc = NULL;
 	struct link_sta_info *link_sta;
 
-	link_sta = rcu_dereference_protected(sta->link[link_id],
-					     lockdep_is_held(&sta->local->sta_mtx));
+	link_sta = rcu_access_pointer(sta->link[link_id]);
+	if (link_sta != &sta->deflink)
+		lockdep_assert_held(&sta->local->sta_mtx);
 
 	if (WARN_ON(!link_sta))
 		return;
-- 
2.50.0


             reply	other threads:[~2025-08-23 20:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-23 20:22 Hanne-Lotta Mäenpää [this message]
2025-08-23 20:22 ` [PATCH 6.1.y 2/2] wifi: mac80211: check basic rates validity in sta_link_apply_parameters Hanne-Lotta Mäenpää

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=20250823202208.43086-1-hannelotta@gmail.com \
    --to=hannelotta@gmail.com \
    --cc=benjamin.berg@intel.com \
    --cc=david.hunter.linux@gmail.com \
    --cc=gregory.greenman@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=shaul.triebitz@intel.com \
    --cc=skhan@linuxfoundation.org \
    --cc=stable@vger.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®