]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: AP MLD: Reassign drv->ctx correctly to prevent hostapd crash
authorMichael-CY Lee <michael-cy.lee@mediatek.com>
Tue, 14 May 2024 01:20:35 +0000 (09:20 +0800)
committerJouni Malinen <j@w1.fi>
Fri, 12 Jul 2024 12:20:44 +0000 (15:20 +0300)
When the first link is deleted and there are still remaining links,
drv->ctx should be updated to the new default link on the bss.
Otherwise, drv->ctx points to the address that has already been freed
and makes hostapd crash.

Fixes: d2b62b3fe500 ("AP MLD: Support link removal before removing interface")
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
src/drivers/driver_nl80211.c

index 2063d5aca3b98bdcdeb6f8d519e488de89b92ea0..b84c0a30265bf9501faba24ba63b0610f63b94be 100644 (file)
@@ -10745,7 +10745,7 @@ static int driver_nl80211_link_remove(void *priv, enum wpa_driver_if_type type,
 
        bss->ctx = bss->flink->ctx;
 
-       if (drv->first_bss == bss && !bss->valid_links)
+       if (drv->first_bss == bss && bss->valid_links)
                drv->ctx = bss->ctx;
 
        if (!bss->valid_links) {