[PATCH v2 5.10.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie()
From: Wentao Guan
Date: Tue Oct 13 2026 - 06:33:39 EST
This error path returns while wdev_lock() is still held, so one
malformed IE request can permanently block later operations on this
wiphy. Route the error through out to release the lock.
This bug is stable-specific: it was introduced by the stable backport
commit 269498ce6c1e ("wifi: cfg80211: validate IEs in
cfg80211_wext_siwgenie()") of upstream
commit a2f5286ca4f3 ("wifi: cfg80211: validate IEs in
cfg80211_wext_siwgenie()"). Upstream is safe because that function
runs under guard(wiphy)(), added by
commit f42d22d3f7963 ("wifi: cfg80211: define and use wiphy guard"),
while this tree still uses explicit locking and the separate wdev
mutex that upstream removed in
commit 076fc8775dafe ("wifi: cfg80211: remove wdev mutex"). Backporting
those locking reworks is not appropriate as a minimal stable fix.
This is a fix for stable v5.10.271 backport commit, so no upstream commit.
Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/93db0eae-f479-4343-a126-59987ae0dc22@xxxxxxxxxx/
Fixes: 269498ce6c1e ("wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()")
Signed-off-by: Wentao Guan <guanwentao@xxxxxxxxxxxxx>
---
changelog v2:
update commit message as greg suggested.
---
---
net/wireless/wext-sme.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index d27ec0163b08b..943e94f4a2634 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -339,8 +339,10 @@ int cfg80211_wext_siwgenie(struct net_device *dev,
/* nothing */
}
- if (!for_each_element_completed(elem, extra, ie_len))
- return -EINVAL;
+ if (!for_each_element_completed(elem, extra, ie_len)) {
+ err = -EINVAL;
+ goto out;
+ }
ie = kmemdup(extra, ie_len, GFP_KERNEL);
if (!ie) {
--
2.39.5