]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Add NULL check for mld pointer during MLD link removal
authorGovindaraj Saminathan <quic_gsaminat@quicinc.com>
Wed, 27 Nov 2024 07:25:35 +0000 (12:55 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 27 Nov 2024 17:18:57 +0000 (19:18 +0200)
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 <quic_gsaminat@quicinc.com>
src/ap/hostapd.c

index c8751a247941e40bfea8c59135f9e7728e16f809..dc50ad1bcc9a66a50c5eddc86cba62ba756adc3f 100644 (file)
@@ -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