1 From 5cc509aa83c6acd2c5cd94f99065c39d2bd0a490 Mon Sep 17 00:00:00 2001
2 From: Navid Emamdoost <navid.emamdoost@gmail.com>
3 Date: Fri, 22 Nov 2019 13:19:48 -0600
4 Subject: [PATCH] brcmfmac: Fix memory leak in brcmf_p2p_create_p2pdev()
6 In the implementation of brcmf_p2p_create_p2pdev() the allocated memory
7 for p2p_vif is leaked when the mac address is the same as primary
8 interface. To fix this, go to error path to release p2p_vif via
11 Fixes: cb746e47837a ("brcmfmac: check p2pdev mac address uniqueness")
12 Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
13 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 3 ++-
16 1 file changed, 2 insertions(+), 1 deletion(-)
18 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
19 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
20 @@ -2092,7 +2092,8 @@ static struct wireless_dev *brcmf_p2p_cr
21 /* firmware requires unique mac address for p2pdev interface */
22 if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) {
23 bphy_err(drvr, "discovery vif must be different from primary interface\n");
24 - return ERR_PTR(-EINVAL);
29 brcmf_p2p_generate_bss_mac(p2p, addr);