a8afab76fa9aee37ac640b5682a62ed8d914f078
[oweals/openwrt.git] /
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
7 If 'wiphy_new()' fails, we leak 'ops'. Add a new label in the error
8 handling path to free it in such a case.
9
10 Cc: stable@vger.kernel.org
11 Fixes: 5c22fb85102a7 ("brcmfmac: add wowl gtk rekeying offload support")
12 Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
13 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
14 ---
15  drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 ++-
16  1 file changed, 2 insertions(+), 1 deletion(-)
17
18 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
19 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
20 @@ -6842,7 +6842,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
21         wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
22         if (!wiphy) {
23                 brcmf_err("Could not allocate wiphy device\n");
24 -               return NULL;
25 +               goto ops_out;
26         }
27         memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
28         set_wiphy_dev(wiphy, busdev);
29 @@ -6985,6 +6985,7 @@ priv_out:
30         ifp->vif = NULL;
31  wiphy_out:
32         brcmf_free_wiphy(wiphy);
33 +ops_out:
34         kfree(ops);
35         return NULL;
36  }