diff mbox series

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

Message ID 20240514012035.23132-1-michael-cy.lee@mediatek.com
State Accepted
Headers show
Series AP MLD: reassign drv->ctx correctly to prevent hostapd crash | expand

Commit Message

Michael-CY Lee May 14, 2024, 1:20 a.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jouni Malinen July 12, 2024, 12:49 p.m. UTC | #1
On Tue, May 14, 2024 at 09:20:35AM +0800, Michael-CY Lee wrote:
> 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.

Thanks, applied.
diff mbox series

Patch

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