mesh: Fix race condition in mesh mpm new peer handling

When wpa_supplicant receives another new peer event before the first one
has been processed, it tries to add a station to the driver a second
time (which fails) and then tears down the station entry until another
event comes in.

Fix this by only adding a station to the driver if it didn't exist
already.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2019-02-17 16:02:56 +01:00 committed by Jouni Malinen
parent ef48f1bfb3
commit 41b06b065e

View file

@ -710,11 +710,12 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
}
sta = ap_get_sta(data, addr);
if (!sta) {
if (sta)
return NULL;
sta = ap_sta_add(data, addr);
if (!sta)
return NULL;
}
/* Set WMM by default since Mesh STAs are QoS STAs */
sta->flags |= WLAN_STA_WMM;