]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: don't WARN for connections on invalid channels
authorJohannes Berg <johannes.berg@intel.com>
Tue, 2 Dec 2025 09:25:11 +0000 (10:25 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 16 Dec 2025 09:23:20 +0000 (10:23 +0100)
It's not clear (to me) how exactly syzbot managed to hit this,
but it seems conceivable that e.g. regulatory changed and has
disabled a channel between scanning (channel is checked to be
usable by cfg80211_get_ies_channel_number) and connecting on
the channel later.

With one scenario that isn't covered elsewhere described above,
the warning isn't good, replace it with a (more informative)
error message.

Reported-by: syzbot+639af5aa411f2581ad38@syzkaller.appspotmail.com
Link: https://patch.msgid.link/20251202102511.5a8fb5184fa3.I961ee41b8f10538a54b8565dbf03ec1696e80e03@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mlme.c

index e56ad4b9330f270f88bd13332a9bf45958835ce3..ad53dedd929c2c577cd95de74d7a51e0e229e04b 100644 (file)
@@ -1126,7 +1126,10 @@ again:
 
        while (!ieee80211_chandef_usable(sdata, &chanreq->oper,
                                         IEEE80211_CHAN_DISABLED)) {
-               if (WARN_ON(chanreq->oper.width == NL80211_CHAN_WIDTH_20_NOHT)) {
+               if (chanreq->oper.width == NL80211_CHAN_WIDTH_20_NOHT) {
+                       link_id_info(sdata, link_id,
+                                    "unusable channel (%d MHz) for connection\n",
+                                    chanreq->oper.chan->center_freq);
                        ret = -EINVAL;
                        goto free;
                }