@@ -168,8 +168,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;
@@ -3080,8 +3080,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;
@@ -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);
In case of MLD AP 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 | 5 ++++- src/ap/hostapd.c | 4 ++-- src/ap/hostapd.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-)