344-v5.2-brcmfmac-fix-missing-checks-for-kmemdup.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From 46953f97224d56a12ccbe9c6acaa84ca0dab2780 Mon Sep 17 00:00:00 2001
  2. From: Kangjie Lu <kjlu@umn.edu>
  3. Date: Fri, 15 Mar 2019 12:04:32 -0500
  4. Subject: [PATCH] brcmfmac: fix missing checks for kmemdup
  5. In case kmemdup fails, the fix sets conn_info->req_ie_len and
  6. conn_info->resp_ie_len to zero to avoid buffer overflows.
  7. Signed-off-by: Kangjie Lu <kjlu@umn.edu>
  8. Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  9. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10. ---
  11. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
  12. 1 file changed, 4 insertions(+)
  13. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  14. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  15. @@ -5436,6 +5436,8 @@ static s32 brcmf_get_assoc_ies(struct br
  16. conn_info->req_ie =
  17. kmemdup(cfg->extra_buf, conn_info->req_ie_len,
  18. GFP_KERNEL);
  19. + if (!conn_info->req_ie)
  20. + conn_info->req_ie_len = 0;
  21. } else {
  22. conn_info->req_ie_len = 0;
  23. conn_info->req_ie = NULL;
  24. @@ -5452,6 +5454,8 @@ static s32 brcmf_get_assoc_ies(struct br
  25. conn_info->resp_ie =
  26. kmemdup(cfg->extra_buf, conn_info->resp_ie_len,
  27. GFP_KERNEL);
  28. + if (!conn_info->resp_ie)
  29. + conn_info->resp_ie_len = 0;
  30. } else {
  31. conn_info->resp_ie_len = 0;
  32. conn_info->resp_ie = NULL;