Received: by 10.213.65.68 with SMTP id h4csp853051imn; Tue, 27 Mar 2018 09:59:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx49K9cFaATbuYZc1G2eVhBop7iQdbq/ea56Pzfqi6HRXQ6KkCobKX2BSo2jeyvHGBeFYwi4e X-Received: by 10.99.96.79 with SMTP id u76mr62062pgb.199.1522169975447; Tue, 27 Mar 2018 09:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522169975; cv=none; d=google.com; s=arc-20160816; b=w8tsWAQrBJB0KBQidpSrknOGRy6F3M0c1RCFwpixczrwyohqnMQrre9vfKBYsVZCnh gnSacQQgUag9yezkpL/9qjOZLPBA8y/d4SVYgwNwT9IbC/EXdX5KXRvUiJh43YApzOcw xaLXcQKxICCSvhoA0kE9x54tRPjszfGSj6HbSevCCe50I2NGJdXcbKolu8qWI2chiVm3 NabqGhcfvsQh9e2YYiUF7QMegaNfeMQaXYto7m3inE9qOxP6RKky4tsTpcuk6+3wM0R+ Xkf5ilYVnT9H7H/jLysaIiiw5CrOyQvOqFsW8ZZgAptP+nbwCHRe/UUccVEfN+Br/YrQ evBA== 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=F3X2XsRDDT71isDWeTlsPEzXXI2Odw23AoziuyU+ZAc=; b=iy6SFCrtbx8KdtZOfwC3pyKNBVxiPo3jsQQBmdG1+LlrZYgPtvvBYhnzj9lAXiqfl9 cbDQTOmLK889lcbfecn9UtbvvWfGuY89ZEznaDk8PA2JY4z+r/l6k2FiT6QW9YtuCmm1 sqNoi5NuDB8If6SL+VoFqPn6XwFsL/yHYr277bIX9bjNhIAaqSYTHb7wkuKJxlEQF5Hd eoNsA+CL9laeJzlXBPyFAHov3IgX1ERqaxe8R15mxX08bbNPQClLZ3rr6OWuV1qq2WJz qTxmcZn70UaakbaM0xO3HsZWE57DXPBRpUTfCmOuqW9XCRo8FkPwGl4LRa+4a9BlSnD6 +OZQ== 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 c4si1130380pgu.355.2018.03.27.09.59.20; Tue, 27 Mar 2018 09:59:35 -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 S1754332AbeC0Q5u (ORCPT + 99 others); Tue, 27 Mar 2018 12:57:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48728 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbeC0Ql2 (ORCPT ); Tue, 27 Mar 2018 12:41:28 -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 CAF8CF3A; Tue, 27 Mar 2018 16:41:27 +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.15 067/105] brcmfmac: fix P2P_DEVICE ethernet address generation Date: Tue, 27 Mar 2018 18:27:47 +0200 Message-Id: <20180327162801.934314008@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@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.15-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