]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: cfg80211: fix width unit in cfg80211_radio_chandef_valid()
authorRyder Lee <ryder.lee@mediatek.com>
Mon, 22 Sep 2025 22:19:08 +0000 (22:19 +0000)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 23 Sep 2025 07:50:02 +0000 (09:50 +0200)
The original code used nl80211_chan_width_to_mhz(), which returns the width in MHz.
However, the expected unit is KHz.

Fixes: 510dba80ed66 ("wifi: cfg80211: add helper for checking if a chandef is valid on a radio")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://patch.msgid.link/df54294e6c4ed0f3ceff6e818b710478ddfc62c0.1758579480.git.Ryder%20Lee%20ryder.lee@mediatek.com/
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/util.c

index f26440d18ad3b7969728e834a359b974a9213084..56724b33af045519b537ae12eb6a36c011189f3e 100644 (file)
@@ -2965,7 +2965,7 @@ bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio,
        u32 freq, width;
 
        freq = ieee80211_chandef_to_khz(chandef);
-       width = cfg80211_chandef_get_width(chandef);
+       width = MHZ_TO_KHZ(cfg80211_chandef_get_width(chandef));
        if (!ieee80211_radio_freq_range_valid(radio, freq, width))
                return false;