]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix AP deinit path (link removal) in error cases
authorJouni Malinen <j@w1.fi>
Fri, 22 Dec 2023 08:57:04 +0000 (10:57 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 22 Dec 2023 09:13:28 +0000 (11:13 +0200)
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 <j@w1.fi>
src/drivers/driver_nl80211.c

index 4bebd6ed3f8cd90c2f7880b1ed563b166f16c50b..0f4259c1c275ed40ac6fdf061c8bb741bae17266 100644 (file)
@@ -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];