From: Jouni Malinen Date: Fri, 22 Dec 2023 08:57:04 +0000 (+0200) Subject: nl80211: Fix AP deinit path (link removal) in error cases X-Git-Tag: hostap_2_11~592 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12a95743425fdf100dbb714416fd11c6beec9a01;p=thirdparty%2Fhostap.git nl80211: Fix AP deinit path (link removal) in error cases If the interface initialization fails, no links might be set when calling the deinit functions. Those functions need to be prepared for bss->n_links being 0. Fixes: 859cbc396fc0 ("nl80211: Remove links when stopping AP MLD in hostapd") Signed-off-by: Jouni Malinen --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 4bebd6ed3..0f4259c1c 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -9372,6 +9372,9 @@ static void nl80211_remove_links(struct i802_bss *bss) int ret; u8 link_id; + if (bss->n_links == 0) + return; + while (bss->links[0].link_id != NL80211_DRV_LINK_ID_NA) { struct i802_link *link = &bss->links[0];