861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  2. Date: Thu, 9 Jul 2015 00:07:59 +0200
  3. Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset=UTF-8
  6. Content-Transfer-Encoding: 8bit
  7. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  8. ---
  9. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  10. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  11. @@ -681,8 +681,36 @@ static struct wireless_dev *brcmf_cfg802
  12. struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  13. struct brcmf_pub *drvr = cfg->pub;
  14. struct wireless_dev *wdev;
  15. + struct net_device *dev;
  16. int err;
  17. + /*
  18. + * There is a bug with in-firmware BSS management. When adding virtual
  19. + * interface brcmfmac first tells firmware to create new BSS and then
  20. + * it creates new struct net_device.
  21. + *
  22. + * If creating/registering netdev(ice) fails, BSS remains in some bugged
  23. + * state. It conflicts with existing BSSes by overtaking their auth
  24. + * requests.
  25. + *
  26. + * It results in one BSS (addresss X) sending beacons and another BSS
  27. + * (address Y) replying to authentication requests. This makes interface
  28. + * unusable as AP.
  29. + *
  30. + * To workaround this bug we may try to guess if register_netdev(ice)
  31. + * will fail. The most obvious case is using interface name that already
  32. + * exists. This is actually quite likely with brcmfmac & some user space
  33. + * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  34. + * So this bug can be triggered even by something trivial like:
  35. + * iw dev wlan0 delete
  36. + * iw phy phy0 interface add wlan0 type __ap
  37. + */
  38. + dev = dev_get_by_name(&init_net, name);
  39. + if (dev) {
  40. + dev_put(dev);
  41. + return ERR_PTR(-ENFILE);
  42. + }
  43. +
  44. brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  45. err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  46. if (err) {