blob: cf9dd47d4baa57efaa561f0cea6c6579c67fcf30 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 6207a7d1f0601a12be9639aa3507faf10b84398a Mon Sep 17 00:00:00 2001
2From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Thu, 15 Aug 2024 18:50:41 +0800
4Subject: [PATCH 126/126] mtk: hostapd: Fix hostapd crash in wds mode during
5 freeing sta
6
7When freeing sta in wds mode, ap_free_sta will pass NULL pointer (ifname_wds)
8to hostapd_set_wds_sta.
9The ifname_wds will directly assigned to name and being used without
10checking whether it is NULL or not in i802_set_wds_sta.
11The following hostapd patch of the openwrt trunk leads to this issue.
12https://github.com/openwrt/openwrt/commit/e80520197c9ca7bced50d3605d6baba6dead6e35
13
14Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
15---
16 src/drivers/driver_nl80211.c | 5 ++++-
17 1 file changed, 4 insertions(+), 1 deletion(-)
18
19diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
20index efee210b9..a08afb5d4 100644
21--- a/src/drivers/driver_nl80211.c
22+++ b/src/drivers/driver_nl80211.c
23@@ -8603,10 +8603,13 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
24 {
25 struct i802_bss *bss = priv;
26 struct wpa_driver_nl80211_data *drv = bss->drv;
27- const char *name = ifname_wds; // Kept to reduce changes to the minimum
28+ char name[IFNAMSIZ + 1];
29 union wpa_event_data event;
30 int ret;
31
32+ if (ifname_wds)
33+ os_strlcpy(name, ifname_wds, IFNAMSIZ + 1);
34+
35 wpa_printf(MSG_DEBUG, "nl80211: Set WDS STA addr=" MACSTR
36 " aid=%d val=%d name=%s", MAC2STR(addr), aid, val, name);
37 if (val) {
38--
392.18.0
40