From: Yuvarani V Date: Wed, 23 Apr 2025 07:14:47 +0000 (+0530) Subject: nl80211: Fix crash by clearing link from valid links after stopping beaconing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dd67a6f9f67f8c6ad181caa0edd6849fe2e77dd;p=thirdparty%2Fhostap.git nl80211: Fix crash by clearing link from valid links after stopping beaconing During link disable in nl80211_remove_link(), the link to be disabled is cleared from the valid links before calling nl80211_update_active_links(). This sequence leads to stopping beaconing on flink, which results in set beacon failure and causes hostapd to crash when the removed link is enabled. Fix this by clearing the link from valid links map after the nl80211_update_active_links() call. Fixes: 2fe31050c248 ("nl80211: Use active_links to notify start/stop state of links") Signed-off-by: Yuvarani V --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 2cff5bba0..2055fb2f2 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -9679,10 +9679,10 @@ int nl80211_remove_link(struct i802_bss *bss, int link_id) os_memcpy(link_addr, link->addr, ETH_ALEN); /* First remove the link locally */ - bss->valid_links &= ~BIT(link_id); os_memset(link->addr, 0, ETH_ALEN); /* Clear the active links and set the flink */ nl80211_update_active_links(bss, link_id); + bss->valid_links &= ~BIT(link_id); /* If this was the last link, reset default link */ if (!bss->valid_links) {