Received: by 10.213.65.68 with SMTP id h4csp904457imn; Tue, 27 Mar 2018 10:55:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx49opWOMHMWvKBD9rndGxmUyX47JZmDhHsxOy0G/xqd9q4qmSnuaVxrCXTCm7TZkhLDUMHuE X-Received: by 10.98.107.138 with SMTP id g132mr216159pfc.163.1522173330510; Tue, 27 Mar 2018 10:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173330; cv=none; d=google.com; s=arc-20160816; b=bIGyGntjeuragPDe85WXFfb3VbPOrlVrHBSdqN/6Uoo9oyAIprgxq8S4AhWz5Fpfg1 fv0uQQbHR6de7Xnpve5ZVsNAnTX2VIXRR9HPafzKdA6DXVPO+tesEDTKt93YtVxk/DO4 kd1fM65b9X9MqdGxCLagrrCp/jU2Nj1gsDJQS4bfg7dUp0aevxALyzC7NhtQQ4lupXDb 1L+nr6xWbkg1hzrdaU9fNGr0iBsa0P7n7BqULw+j8pnpIo7ZblGhHJ663W1W/uQdEGIk u4KwEgc3pDvOsgbN9nDJrs8uttEUjLwpN3r/n13EQfvZR7oE9yt+PCq9lBx9A9oY/2PT dxpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=VzgNppc62vdL6044+AYs4fLIczRaMeiHF8M7rSD5aKg=; b=VuV9VzPlxtmK8UzF19V98FgTbfucr5jBT2TBuSQ4UM3nEFTDYmgdEobAkQDAUTOnYZ MIiQLs4e5vbG9pqpcZbY60HWBrev+soUTBiBaohWW+ZvdYmsrTJTZQnD5BBqWEkIOB9E myM45u16C0vzh+SaBER933YewDxBp69xcJrzFuG2QWxeO1sZl59LW3cxaQE6qxDAE5BR ozmxUaczGHZK0FMM3sukbzcKT0L0FxbhDni4gEu2CBByYZznYvwcLXOKA/MOYrgBPlFp gs04dGmKsENFtjbBUTLeZqVbGaettGFAbBd68m2EQFyiuyze32Mmoiz1AFG1UXFH3jLd KYRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r25si1105908pge.759.2018.03.27.10.55.16; Tue, 27 Mar 2018 10:55:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753573AbeC0Rxn (ORCPT + 99 others); Tue, 27 Mar 2018 13:53:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43126 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753473AbeC0Qbz (ORCPT ); Tue, 27 Mar 2018 12:31:55 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9B958F05; Tue, 27 Mar 2018 16:31:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Hante Meuleman , Pieter-Paul Giesberts , Franky Lin , Arend van Spriel , Kalle Valo Subject: [PATCH 4.9 35/67] brcmfmac: fix P2P_DEVICE ethernet address generation Date: Tue, 27 Mar 2018 18:27:27 +0200 Message-Id: <20180327162728.938843300@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arend Van Spriel commit 455f3e76cfc0d893585a5f358b9ddbe9c1e1e53b upstream. 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: stable@vger.kernel.org # 3.10.y Reported-by: Hans de Goede Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 24 +++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c @@ -462,25 +462,23 @@ static int brcmf_p2p_set_firmware(struct * @dev_addr: optional device address. * * P2P needs mac addresses for P2P device and interface. If no device - * address it specified, these are derived from the primary net device, ie. - * the permanent ethernet address of the device. + * address it specified, these are derived from a random ethernet + * address. */ static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr) { - struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; - bool local_admin = false; + bool random_addr = false; - if (!dev_addr || is_zero_ether_addr(dev_addr)) { - dev_addr = pri_ifp->mac_addr; - local_admin = true; - } + if (!dev_addr || is_zero_ether_addr(dev_addr)) + random_addr = true; - /* Generate the P2P Device Address. This consists of the device's - * primary MAC address with the locally administered bit set. + /* Generate the P2P Device Address obtaining a random ethernet + * address with the locally administered bit set. */ - memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); - if (local_admin) - p2p->dev_addr[0] |= 0x02; + if (random_addr) + eth_random_addr(p2p->dev_addr); + else + memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); /* Generate the P2P Interface Address. If the discovery and connection * BSSCFGs need to simultaneously co-exist, then this address must be