From: Govindaraj Saminathan Date: Wed, 27 Nov 2024 07:25:35 +0000 (+0530) Subject: AP MLD: Add NULL check for mld pointer during MLD link removal X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0aac2cd3da33f03dbff807f4f6c15a555aa7ea6;p=thirdparty%2Fhostap.git AP MLD: Add NULL check for mld pointer during MLD link removal MLD control interface creation failed randomly because the existing control interface was not properly cleaned up. During the failure case handling, the memory allocated for hapd->mld is freed in hostapd_bss_setup_multi_link(). Subsequently, when performing MLD link removal during the interface down, hostapd_mld_remove_link() attempts to access the mld pointer without NULL check, causing a segmentation fault. To prevent this issue, add a validation to check if the mld pointer is NULL before accessing it. Signed-off-by: Govindaraj Saminathan --- diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index c8751a247..dc50ad1bc 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -633,7 +633,7 @@ static void hostapd_bss_link_deinit(struct hostapd_data *hapd) } /* Put all freeing logic above this */ - if (!hapd->mld->num_links) + if (!hapd->mld || !hapd->mld->num_links) return; /* If not started, not yet linked to the MLD. However, the first