]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Fix a crash in hostapd_driver_init()
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Sun, 1 Sep 2024 16:31:35 +0000 (19:31 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 21 Dec 2024 08:57:05 +0000 (10:57 +0200)
In case of an AP MLD it is assumed that the multi link information
(hapd->mld) is already initialized by the time this function is called.
However, if the interface is added without bss_config parameter,
hostapd_bss_setup_multi_link() would bail out immediately as mld_ap
parameter isn't set yet. When the interface gets enabled later,
hapd->mld would be NULL resulting in NULL dereference.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
hostapd/main.c
src/ap/hostapd.c
src/ap/hostapd.h

index 43c4fa1fb24eac9328daccf974119f9f9915ddd0..a8bb9d4d691790bf3e24a4c6019f504a7fc6c5a8 100644 (file)
@@ -169,8 +169,11 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
        }
 
 #ifdef CONFIG_IEEE80211BE
-       if (conf->mld_ap)
+       if (conf->mld_ap) {
+               if (!hapd->mld)
+                       hostapd_bss_setup_multi_link(hapd, iface->interfaces);
                h_hapd = hostapd_mld_get_first_bss(hapd);
+       }
 
        if (h_hapd) {
                hapd->drv_priv = h_hapd->drv_priv;
index 9dfc21e00f3e68f1e08970d5d8e613381e36e61d..92478c29a786131186bce07a868a9535ca6ff2ad 100644 (file)
@@ -3100,8 +3100,8 @@ static void hostapd_bss_alloc_link_id(struct hostapd_data *hapd)
 #endif /* CONFIG_IEEE80211BE */
 
 
-static void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
-                                        struct hapd_interfaces *interfaces)
+void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
+                                 struct hapd_interfaces *interfaces)
 {
 #ifdef CONFIG_IEEE80211BE
        struct hostapd_mld *mld, **all_mld;
index 0862d5dfd9330331394d7641809f83cd97399716..8edfc827c8cf7bc6bca11d607aec9852b581d2fd 100644 (file)
@@ -766,6 +766,8 @@ struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces,
 struct hostapd_iface *
 hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
                           const char *config_fname, int debug);
+void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
+                                 struct hapd_interfaces *interfaces);
 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
                           int reassoc);
 void hostapd_interface_deinit_free(struct hostapd_iface *iface);