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