b5bd7b0a68a37e03f07c3c3bfff05aac55e74863
[openwrt/staging/rmilecki.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Tue, 12 Feb 2019 14:22:43 +0100
3 Subject: [PATCH] wpa_supplicant: fix race condition in mesh mpm new peer
4 handling
5
6 When wpa_supplicant receives another new peer event before the first one
7 has been processed, it tries to add a station to the driver a second time
8 (which fails) and then tears down the station entry until another event
9 comes in.
10 Fix this by only adding a station to the driver if it didn't exist already.
11
12 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 ---
14
15 --- a/wpa_supplicant/mesh_mpm.c
16 +++ b/wpa_supplicant/mesh_mpm.c
17 @@ -663,11 +663,12 @@ static struct sta_info * mesh_mpm_add_pe
18 }
19
20 sta = ap_get_sta(data, addr);
21 - if (!sta) {
22 - sta = ap_sta_add(data, addr);
23 - if (!sta)
24 - return NULL;
25 - }
26 + if (sta)
27 + return sta;
28 +
29 + sta = ap_sta_add(data, addr);
30 + if (!sta)
31 + return NULL;
32
33 /* Set WMM by default since Mesh STAs are QoS STAs */
34 sta->flags |= WLAN_STA_WMM;