[PATCH] nl80211: nullptr check for link before use

Jintao Lin jintaolin at chromium.org
Fri Aug 9 11:10:34 PDT 2024


bss->flink could be nullptr when wpa_driver_nl80211_del_beacon is called
if wpa_driver_nl80211_drv_init fails early and jump to
wpa_driver_nl80211_deinit with bss->flink unset.

Signed-off-by: Jintao Lin <jintaolin at chromium.org>
---
 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 12fe4d12d..5deca7bc2 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -3071,7 +3071,7 @@ static int wpa_driver_nl80211_del_beacon(struct i802_bss *bss,
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	struct i802_link *link = nl80211_get_link(bss, link_id);
 
-	if (!link->beacon_set)
+	if (!link || !link->beacon_set)
 		return 0;
 
 	wpa_printf(MSG_DEBUG, "nl80211: Remove beacon (ifindex=%d)",
-- 
2.46.0.76.ge559c4bf1a-goog




More information about the Hostap mailing list