323-v4.13-0005-brcmfmac-Fix-a-memory-leak-in-error-handling-path-in.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From 57c00f2fac512837f8de73474ec1f54020015bae Mon Sep 17 00:00:00 2001
  2. From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
  3. Date: Wed, 21 Jun 2017 07:45:53 +0200
  4. Subject: [PATCH] brcmfmac: Fix a memory leak in error handling path in
  5. 'brcmf_cfg80211_attach'
  6. If 'wiphy_new()' fails, we leak 'ops'. Add a new label in the error
  7. handling path to free it in such a case.
  8. Cc: stable@vger.kernel.org
  9. Fixes: 5c22fb85102a7 ("brcmfmac: add wowl gtk rekeying offload support")
  10. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
  11. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12. ---
  13. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 ++-
  14. 1 file changed, 2 insertions(+), 1 deletion(-)
  15. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  16. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17. @@ -6843,7 +6843,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  18. wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
  19. if (!wiphy) {
  20. brcmf_err("Could not allocate wiphy device\n");
  21. - return NULL;
  22. + goto ops_out;
  23. }
  24. memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
  25. set_wiphy_dev(wiphy, busdev);
  26. @@ -6986,6 +6986,7 @@ priv_out:
  27. ifp->vif = NULL;
  28. wiphy_out:
  29. brcmf_free_wiphy(wiphy);
  30. +ops_out:
  31. kfree(ops);
  32. return NULL;
  33. }