Skip to contentSkip to conversation

wifi: cfg80211: validate chandef before calling cfg80211_set_monitor_channel

PATCH New Kartik Nair 1 participant 1 message May 10 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: cfg80211: validate chandef before calling cfg80211_set_monitor_channel

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.

---
 net/wireless/wext-compat.c | 2 ++
 1 file changed, 2 insertions(+)
net/wireless/wext-compat.c +2 -0
index 22d9d9bae..63d145b52 100644
@@ -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);
Signature · 1 line
2.50.0