051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch 938 B

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