From: Cen Zhang <zzzccc427@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, baijiaju1990@gmail.com,
zzzccc427@gmail.com
Subject: [PATCH v2] wifi: cfg80211: BUG on runaway wiphy work drains
Date: Wed, 8 Jul 2026 11:14:22 +0800 [thread overview]
Message-ID: <20260708031422.2215685-1-zzzccc427@gmail.com> (raw)
cfg80211_process_wiphy_works() currently tries to recover from a
runaway drain by reinitializing rdev->wiphy_work_list. That avoids
walking the list any further, but it can strand valid owner-embedded work
entries with stale list links. Trying to fix that by walking the
remaining list is not safe either, because the guard may have fired after
list corruption or accidental work reinitialization.
Stop trying to recover from this state. Raise the limit to 30000
iterations so ordinary long drains have much more headroom, and BUG() if
the guard still fires. At that point the code cannot reliably tell a
self-requeueing work loop from a corrupted list, and continuing risks
either silently losing work or touching corrupted links.
Fixes: a3ee4dc84c4e ("wifi: cfg80211: add a work abstraction with special semantics")
Assisted-by: Codex:gpt-5.5
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
---
v2:
- Raise the runaway limit to 30000 and BUG() if it is still hit.
- Drop the per-entry drain so the fallback does not walk a possibly
corrupted list.
net/wireless/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 3dcf63b04c41..9a4d022f8838 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1256,7 +1256,7 @@ EXPORT_SYMBOL(wiphy_rfkill_start_polling);
void cfg80211_process_wiphy_works(struct cfg80211_registered_device *rdev,
struct wiphy_work *end)
{
- unsigned int runaway_limit = 100;
+ unsigned int runaway_limit = 30000;
unsigned long flags;
lockdep_assert_held(&rdev->wiphy.mtx);
@@ -1278,8 +1278,8 @@ void cfg80211_process_wiphy_works(struct cfg80211_registered_device *rdev,
if (wk == end)
break;
- if (WARN_ON(--runaway_limit == 0))
- INIT_LIST_HEAD(&rdev->wiphy_work_list);
+ if (--runaway_limit == 0)
+ BUG();
}
spin_unlock_irqrestore(&rdev->wiphy_work_lock, flags);
}
--
2.43.0
reply other threads:[~2026-07-08 3:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260708031422.2215685-1-zzzccc427@gmail.com \
--to=zzzccc427@gmail.com \
--cc=baijiaju1990@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@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