wifi: cfg80211: validate chandef before calling cfg80211_set_monitor_channel
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.
Reported-by [email protected]
Signed-off-by Kartik Nair <[email protected]>
--- net/wireless/wext-compat.c | 2 ++ 1 file changed, 2 insertions(+)
net/wireless/wext-compat.c +2 -0
@@ -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