Skip to content

Commit

Permalink
brcmfmac: Fix memory leak in brcmf_p2p_create_p2pdev()
Browse files Browse the repository at this point in the history
In the implementation of brcmf_p2p_create_p2pdev() the allocated memory
for p2p_vif is leaked when the mac address is the same as primary
interface. To fix this, go to error path to release p2p_vif via
brcmf_free_vif().

Fixes: cb746e4 ("brcmfmac: check p2pdev mac address uniqueness")
Signed-off-by: Navid Emamdoost <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
  • Loading branch information
Navidem authored and Kalle Valo committed Dec 18, 2019
1 parent 57725b5 commit 5cc509a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,8 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
/* firmware requires unique mac address for p2pdev interface */
if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) {
bphy_err(drvr, "discovery vif must be different from primary interface\n");
return ERR_PTR(-EINVAL);
err = -EINVAL;
goto fail;
}

brcmf_p2p_generate_bss_mac(p2p, addr);
Expand Down

0 comments on commit 5cc509a

Please sign in to comment.