hostapd: fix crash on interface setup failure
authorFelix Fietkau <nbd@nbd.name>
Fri, 14 Jun 2024 12:43:39 +0000 (14:43 +0200)
committerRISCi_ATOM <bob@bobcall.me>
Thu, 11 Jul 2024 15:22:19 +0000 (11:22 -0400)
Add a missing NULL pointer check when deleting beacons

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 3984fb0582083c5c0f511ed3a33eb17908eccb08)
Link: https://github.com/openwrt/openwrt/pull/15898
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/network/services/hostapd/patches/060-nl80211-fix-crash-when-adding-an-interface-fails.patch [new file with mode: 0644]

diff --git a/package/network/services/hostapd/patches/060-nl80211-fix-crash-when-adding-an-interface-fails.patch b/package/network/services/hostapd/patches/060-nl80211-fix-crash-when-adding-an-interface-fails.patch
new file mode 100644 (file)
index 0000000..44ba6c0
--- /dev/null
@@ -0,0 +1,21 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Fri, 14 Jun 2024 14:41:16 +0200
+Subject: [PATCH] nl80211: fix crash when adding an interface fails
+
+When adding an interface fails early, the bss link is still NULL.
+Avoid crashing on deleting beacons.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/src/drivers/driver_nl80211.c
++++ b/src/drivers/driver_nl80211.c
+@@ -3004,7 +3004,7 @@ static int wpa_driver_nl80211_del_beacon
+       struct nl_msg *msg;
+       struct wpa_driver_nl80211_data *drv = bss->drv;
+-      if (!link->beacon_set)
++      if (!link || !link->beacon_set)
+               return 0;
+       wpa_printf(MSG_DEBUG, "nl80211: Remove beacon (ifindex=%d)",