Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH v3 6.6.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie()
@ 2026-10-13 10:20 Wentao Guan
  2026-10-13 10:20 ` [PATCH v2 6.1.y] " Wentao Guan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Wentao Guan @ 2026-10-13 10:20 UTC (permalink / raw)
  To: gregkh, sashal, kartikey406, harshit.m.mogalapalli, johannes
  Cc: linux-wireless, linux-kernel, stable, Wentao Guan

This error path returns while both wiphy_lock() and wdev_lock() are still
held, so one malformed IE request can permanently block later operations
on this wiphy. Route the error through out to release both locks.

This bug is stable-specific: it was introduced by the stable backport
commit d01f1600e8b0 ("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 v6.6.158 backport commit, so no upstream commit.

Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Closes: https://lore.kernel.org/all/93db0eae-f479-4343-a126-59987ae0dc22@oracle.com/
Fixes: d01f1600e8b0 ("wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
changelog v3:
update message as greg suggested.
changelog v2:
add reported by.
---
---
 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 cfa903eb0e82f..0e7c314bdeef0 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -354,8 +354,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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 6.1.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie()
  2026-10-13 10:20 [PATCH v3 6.6.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie() Wentao Guan
@ 2026-10-13 10:20 ` Wentao Guan
  2026-10-13 10:20 ` [PATCH v2 5.15.y] " Wentao Guan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Wentao Guan @ 2026-10-13 10:20 UTC (permalink / raw)
  To: gregkh, sashal, kartikey406, harshit.m.mogalapalli, johannes
  Cc: linux-wireless, linux-kernel, stable, Wentao Guan

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 8b921a899346 ("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 v6.1.189 backport commit, so no upstream commit.

Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Closes: https://lore.kernel.org/all/93db0eae-f479-4343-a126-59987ae0dc22@oracle.com/
Fixes: 8b921a899346 ("wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
changelog v2:
update commit message as gregkh 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 be121fa36c514..ba6d8827f64b3 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -352,8 +352,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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 5.15.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie()
  2026-10-13 10:20 [PATCH v3 6.6.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie() Wentao Guan
  2026-10-13 10:20 ` [PATCH v2 6.1.y] " Wentao Guan
@ 2026-10-13 10:20 ` Wentao Guan
  2026-10-13 10:20 ` [PATCH v2 5.10.y] " Wentao Guan
  2026-10-14 22:33 ` [PATCH v3 6.6.y] " Sasha Levin
  3 siblings, 0 replies; 5+ messages in thread
From: Wentao Guan @ 2026-10-13 10:20 UTC (permalink / raw)
  To: gregkh, sashal, kartikey406, harshit.m.mogalapalli, johannes
  Cc: linux-wireless, linux-kernel, stable, Wentao Guan

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 685082f4be77 ("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.15.222 backport commit, so no upstream commit.

Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Closes: https://lore.kernel.org/all/93db0eae-f479-4343-a126-59987ae0dc22@oracle.com/
Fixes: 685082f4be77 ("wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
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 1919290d1208d..f0c9aab622385 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 5.10.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie()
  2026-10-13 10:20 [PATCH v3 6.6.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie() Wentao Guan
  2026-10-13 10:20 ` [PATCH v2 6.1.y] " Wentao Guan
  2026-10-13 10:20 ` [PATCH v2 5.15.y] " Wentao Guan
@ 2026-10-13 10:20 ` Wentao Guan
  2026-10-14 22:33 ` [PATCH v3 6.6.y] " Sasha Levin
  3 siblings, 0 replies; 5+ messages in thread
From: Wentao Guan @ 2026-10-13 10:20 UTC (permalink / raw)
  To: gregkh, sashal, kartikey406, harshit.m.mogalapalli, johannes
  Cc: linux-wireless, linux-kernel, stable, Wentao Guan

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@oracle.com>
Closes: https://lore.kernel.org/all/93db0eae-f479-4343-a126-59987ae0dc22@oracle.com/
Fixes: 269498ce6c1e ("wifi: cfg80211: validate IEs in cfg80211_wext_siwgenie()")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 6.6.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie()
  2026-10-13 10:20 [PATCH v3 6.6.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie() Wentao Guan
                   ` (2 preceding siblings ...)
  2026-10-13 10:20 ` [PATCH v2 5.10.y] " Wentao Guan
@ 2026-10-14 22:33 ` Sasha Levin
  3 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-10-14 22:33 UTC (permalink / raw)
  To: gregkh, kartikey406, harshit.m.mogalapalli, johannes
  Cc: Sasha Levin, linux-wireless, linux-kernel, stable, Wentao Guan

On Tue, Oct 13, 2026 at 06:20:39PM +0800, Wentao Guan wrote:
> This is a fix for stable v6.6.158 backport commit, so no upstream commit.

Thanks, v3 has been queued for 6.6 in place of the earlier version.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-14 22:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 10:20 [PATCH v3 6.6.y] wifi: cfg80211: release locks on error in cfg80211_wext_siwgenie() Wentao Guan
2026-10-13 10:20 ` [PATCH v2 6.1.y] " Wentao Guan
2026-10-13 10:20 ` [PATCH v2 5.15.y] " Wentao Guan
2026-10-13 10:20 ` [PATCH v2 5.10.y] " Wentao Guan
2026-10-14 22:33 ` [PATCH v3 6.6.y] " Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox