nl80211: AP MLD: Reassign drv->ctx correctly to prevent hostapd crash

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: d2b62b3fe5 ("AP MLD: Support link removal before removing interface")
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
This commit is contained in:
Michael-CY Lee 2024-05-14 09:20:35 +08:00 committed by Jouni Malinen
parent 3137a41247
commit 7c935eef36

View 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) {