351-0035-brcmfmac-fix-pmksa-bssid-usage.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 7703773ef1d85b40433902a8da20167331597e4a Mon Sep 17 00:00:00 2001
  2. From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
  3. Date: Tue, 23 Aug 2016 11:37:17 +0200
  4. Subject: [PATCH] brcmfmac: fix pmksa->bssid usage
  5. The struct cfg80211_pmksa defines its bssid field as:
  6. const u8 *bssid;
  7. contrary to struct brcmf_pmksa, which uses:
  8. u8 bssid[ETH_ALEN];
  9. Therefore in brcmf_cfg80211_del_pmksa(), &pmksa->bssid takes the address
  10. of this field (of type u8**), not the one of its content (which would be
  11. u8*). Remove the & operator to make brcmf_dbg("%pM") and memcmp()
  12. behave as expected.
  13. This bug have been found using a custom static checker (which checks the
  14. usage of %p... attributes at build time). It has been introduced in
  15. commit 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code"),
  16. which replaced pmksa->bssid by &pmksa->bssid while refactoring the code,
  17. without modifying struct cfg80211_pmksa definition.
  18. Replace &pmk[i].bssid with pmk[i].bssid too to make the code clearer,
  19. this change does not affect the semantic.
  20. Fixes: 6c404f34f2bd ("brcmfmac: Cleanup pmksa cache handling code")
  21. Cc: stable@vger.kernel.org
  22. Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
  23. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24. ---
  25. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++--
  26. 1 file changed, 2 insertions(+), 2 deletions(-)
  27. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  28. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  29. @@ -3804,11 +3804,11 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
  30. if (!check_vif_up(ifp->vif))
  31. return -EIO;
  32. - brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", &pmksa->bssid);
  33. + brcmf_dbg(CONN, "del_pmksa - PMK bssid = %pM\n", pmksa->bssid);
  34. npmk = le32_to_cpu(cfg->pmk_list.npmk);
  35. for (i = 0; i < npmk; i++)
  36. - if (!memcmp(&pmksa->bssid, &pmk[i].bssid, ETH_ALEN))
  37. + if (!memcmp(pmksa->bssid, pmk[i].bssid, ETH_ALEN))
  38. break;
  39. if ((npmk > 0) && (i < npmk)) {