Skip to content

Commit 455f3e7

Browse files
Arend Van SprielKalle Valo
authored andcommitted
brcmfmac: fix P2P_DEVICE ethernet address generation
The firmware has a requirement that the P2P_DEVICE address should be different from the address of the primary interface. When not specified by user-space, the driver generates the MAC address for the P2P_DEVICE interface using the MAC address of the primary interface and setting the locally administered bit. However, the MAC address of the primary interface may already have that bit set causing the creation of the P2P_DEVICE interface to fail with -EBUSY. Fix this by using a random address instead to determine the P2P_DEVICE address. Cc: [email protected] # 3.10.y Reported-by: Hans de Goede <[email protected]> Reviewed-by: Hante Meuleman <[email protected]> Reviewed-by: Pieter-Paul Giesberts <[email protected]> Reviewed-by: Franky Lin <[email protected]> Signed-off-by: Arend van Spriel <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 9338973 commit 455f3e7

File tree

1 file changed

+11
-13
lines changed
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

1 file changed

+11
-13
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -462,25 +462,23 @@ static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
462462
* @dev_addr: optional device address.
463463
*
464464
* P2P needs mac addresses for P2P device and interface. If no device
465-
* address it specified, these are derived from the primary net device, ie.
466-
* the permanent ethernet address of the device.
465+
* address it specified, these are derived from a random ethernet
466+
* address.
467467
*/
468468
static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr)
469469
{
470-
struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
471-
bool local_admin = false;
470+
bool random_addr = false;
472471

473-
if (!dev_addr || is_zero_ether_addr(dev_addr)) {
474-
dev_addr = pri_ifp->mac_addr;
475-
local_admin = true;
476-
}
472+
if (!dev_addr || is_zero_ether_addr(dev_addr))
473+
random_addr = true;
477474

478-
/* Generate the P2P Device Address. This consists of the device's
479-
* primary MAC address with the locally administered bit set.
475+
/* Generate the P2P Device Address obtaining a random ethernet
476+
* address with the locally administered bit set.
480477
*/
481-
memcpy(p2p->dev_addr, dev_addr, ETH_ALEN);
482-
if (local_admin)
483-
p2p->dev_addr[0] |= 0x02;
478+
if (random_addr)
479+
eth_random_addr(p2p->dev_addr);
480+
else
481+
memcpy(p2p->dev_addr, dev_addr, ETH_ALEN);
484482

485483
/* Generate the P2P Interface Address. If the discovery and connection
486484
* BSSCFGs need to simultaneously co-exist, then this address must be

0 commit comments

Comments
 (0)