351-0045-brcmfmac-fix-clearing-entry-IPv6-address.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 2b7425f3629b38c438f890c20c5faeca64b144ff Mon Sep 17 00:00:00 2001
  2. From: Hante Meuleman <hante.meuleman@broadcom.com>
  3. Date: Mon, 19 Sep 2016 12:09:57 +0100
  4. Subject: [PATCH] brcmfmac: fix clearing entry IPv6 address
  5. When IPv6 address is to be cleared there is a possible out of
  6. bound access. But also the clearing of the last entry and the
  7. adjustment of total number of stored IPv6 addresses is not
  8. updated. This patch fixes that bug. Bug was found using coverity.
  9. Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
  10. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  11. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  12. Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  13. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  14. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15. ---
  16. drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 7 +++++--
  17. 1 file changed, 5 insertions(+), 2 deletions(-)
  18. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  19. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  20. @@ -873,9 +873,12 @@ static int brcmf_inet6addr_changed(struc
  21. }
  22. break;
  23. case NETDEV_DOWN:
  24. - if (i < NDOL_MAX_ENTRIES)
  25. - for (; i < ifp->ipv6addr_idx; i++)
  26. + if (i < NDOL_MAX_ENTRIES) {
  27. + for (; i < ifp->ipv6addr_idx - 1; i++)
  28. table[i] = table[i + 1];
  29. + memset(&table[i], 0, sizeof(table[i]));
  30. + ifp->ipv6addr_idx--;
  31. + }
  32. break;
  33. default:
  34. break;