]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Sanitize link ID in mlme_event_ch_switch() for AP interface
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Wed, 7 Aug 2024 04:18:37 +0000 (09:48 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 8 Aug 2024 19:18:49 +0000 (22:18 +0300)
During channel switch handling for AP MLD, if link ID is incorrect,
there is no point in proceeding till end and failing or returning from
there. Hence sanitize it in the initial time itself and return if it is
incorrect. Throw a warning print if it is not correct as well.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
src/drivers/driver_nl80211_event.c

index abe90e984ad7d027dbb7fb9eb88d6549bd61f124..aadefc7b74599723c8456f28cfffb6f5a576df43 100644 (file)
@@ -1303,6 +1303,14 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
                        return;
        }
 
+       if (link && is_ap_interface(drv->nlmode) &&
+           !nl80211_link_valid(bss->valid_links, data.ch_switch.link_id)) {
+               wpa_printf(MSG_WARNING,
+                          "nl80211: Unknown link ID (%d) for channel switch (%s), ignoring",
+                          data.ch_switch.link_id, bss->ifname);
+               return;
+       }
+
        drv->assoc_freq = data.ch_switch.freq;
 
        wpa_supplicant_event(bss->ctx, finished ?