351-0046-brcmfmac-fix-out-of-bound-access-on-clearing-wowl-wa.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From a7ed7828ecda0c2b5e0d7f55dedd4230afd4b583 Mon Sep 17 00:00:00 2001
  2. From: Hante Meuleman <hante.meuleman@broadcom.com>
  3. Date: Mon, 19 Sep 2016 12:09:58 +0100
  4. Subject: [PATCH] brcmfmac: fix out of bound access on clearing wowl wake
  5. indicator
  6. Clearing the wowl wakeindicator happens with a rather odd
  7. construction where the string "clear" is used to set the iovar
  8. wowl_wakeind. This was implemented incorrectly as it caused an
  9. out of bound access. Use an intermediate variable of correct
  10. length and copy string in that. Problem was found using coverity.
  11. Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  12. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  13. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  14. Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  15. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  16. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17. ---
  18. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++++--
  19. 1 file changed, 4 insertions(+), 2 deletions(-)
  20. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  21. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  22. @@ -3623,6 +3623,7 @@ static void brcmf_configure_wowl(struct
  23. struct cfg80211_wowlan *wowl)
  24. {
  25. u32 wowl_config;
  26. + struct brcmf_wowl_wakeind_le wowl_wakeind;
  27. u32 i;
  28. brcmf_dbg(TRACE, "Suspend, wowl config.\n");
  29. @@ -3664,8 +3665,9 @@ static void brcmf_configure_wowl(struct
  30. if (!test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state))
  31. wowl_config |= BRCMF_WOWL_UNASSOC;
  32. - brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear",
  33. - sizeof(struct brcmf_wowl_wakeind_le));
  34. + memcpy(&wowl_wakeind, "clear", 6);
  35. + brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", &wowl_wakeind,
  36. + sizeof(wowl_wakeind));
  37. brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  38. brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  39. brcmf_bus_wowl_config(cfg->pub->bus_if, true);