351-0036-brcmfmac-avoid-potential-stack-overflow-in-brcmf_cfg.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. From ded89912156b1a47d940a0c954c43afbabd0c42c Mon Sep 17 00:00:00 2001
  2. From: Arend Van Spriel <arend.vanspriel@broadcom.com>
  3. Date: Mon, 5 Sep 2016 10:45:47 +0100
  4. Subject: [PATCH] brcmfmac: avoid potential stack overflow in
  5. brcmf_cfg80211_start_ap()
  6. User-space can choose to omit NL80211_ATTR_SSID and only provide raw
  7. IE TLV data. When doing so it can provide SSID IE with length exceeding
  8. the allowed size. The driver further processes this IE copying it
  9. into a local variable without checking the length. Hence stack can be
  10. corrupted and used as exploit.
  11. Cc: stable@vger.kernel.org # v4.7
  12. Reported-by: Daxing Guo <freener.gdx@gmail.com>
  13. Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  14. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  15. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  16. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  17. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18. ---
  19. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +-
  20. 1 file changed, 1 insertion(+), 1 deletion(-)
  21. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  22. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  23. @@ -4447,7 +4447,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  24. (u8 *)&settings->beacon.head[ie_offset],
  25. settings->beacon.head_len - ie_offset,
  26. WLAN_EID_SSID);
  27. - if (!ssid_ie)
  28. + if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN)
  29. return -EINVAL;
  30. memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len);