Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: cfg80211: validate chandef before calling cfg80211_set_monitor_channel
@ 2026-05-10 20:24 Kartik Nair
  0 siblings, 0 replies; only message in thread
From: Kartik Nair @ 2026-05-10 20:24 UTC (permalink / raw)
  To: johannes
  Cc: linux-wireless, linux-kernel, Kartik Nair,
	syzbot+02a1a03b8622d3c7d1c9

cfg80211_wext_siwfreq() constructs a channel definition for monitor
mode but passes it to cfg80211_set_monitor_channel() without first
validating it with cfg80211_chandef_valid(). This causes a WARN_ON
in cfg80211_chandef_dfs_required() when it receives an invalid chandef.

Add the missing cfg80211_chandef_valid() check before calling
cfg80211_set_monitor_channel() to return -EINVAL early on invalid
channel definitions, consistent with how other callers handle this.

Reported-by: syzbot+02a1a03b8622d3c7d1c9@syzkaller.appspotmail.com
Signed-off-by: Kartik Nair <contact.kartikn@gmail.com>
---
 net/wireless/wext-compat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 22d9d9bae..63d145b52 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -789,6 +789,8 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
 		chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq);
 		if (!chandef.chan)
 			return -EINVAL;
+		if (!cfg80211_chandef_valid(&chandef))
+			return -EINVAL;
 		return cfg80211_set_monitor_channel(rdev, dev, &chandef);
 	case NL80211_IFTYPE_MESH_POINT:
 		freq = cfg80211_wext_freq(wextfreq);
-- 
2.50.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-10 20:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10 20:24 [PATCH] wifi: cfg80211: validate chandef before calling cfg80211_set_monitor_channel Kartik Nair

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