[PATCH] AP MLD: reassign drv->ctx correctly to prevent hostapd crash

Michael-CY Lee michael-cy.lee at mediatek.com
Mon May 13 18:20:35 PDT 2024


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 at mediatek.com>
---
 src/drivers/driver_nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 149f51a74..166aed7ad 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -10740,7 +10740,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) {
-- 
2.25.1




More information about the Hostap mailing list