Received: by 10.213.65.68 with SMTP id h4csp916216imn; Tue, 27 Mar 2018 11:08:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/0H45oL+RlygAo8vb3FDFkr3yx4Uh971kvN8ADtXFq/564gNGwTB61RvvApg8EHMYDL3RQ X-Received: by 2002:a17:902:bc02:: with SMTP id n2-v6mr299913pls.347.1522174099602; Tue, 27 Mar 2018 11:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522174099; cv=none; d=google.com; s=arc-20160816; b=bs+wAGC9nWnXUiBZPkMC44t8BKZGCqqMK4AUqUQjnS3ygsdCo7ipMRbMaaU64aoRba 7lHTTfc+bFOE6K7OGO0wXP4MyW/OTKaeQHo2imBNi7bXvzg+7BJ+FW+Wlzpnn40SN6Dh 9si1mZdi+zq1zhI7wF6Wf+WlXwWnQJgRPCZrbi3B9WALGLxEMP+/NYrujhBPv1iVQbhK Cy4y00w9zO7JsNV8iOYjwOVX6TX8NwHyEbAMzxb1BWwcPOE791WzSbaJwaxBMrH7EuOP 15utzNQZgJaGq/zVzTNIFxxqHRSE0xh2+/V7kwFkt7gu/YWDURYpXTJ3EmVvh7zVYWgg 341Q== 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=6qb6DmrGsAgSWJscIglH26KCJFUNu2KgRLDIu3GF45E=; b=qKI5Ow4yAM1byVplA+ztRzbg/vzJ4jRZug+V3K7L3Fw/yQcxYXmMsuRSCxiR+DJIY1 +o7U2pn+RFdX4I6Mw1P3WdFZ90lFL6ODuHLiBmSJxzo7aQwsNdDEzfeiCK7DXroaBnQq 9nfnXJ6tyyyA+uVXyk51/dbgTR2vH4B2B9tHX7YwPsiRWVaCUvU3Z4xgy4zUPAPFsM3G mL0VfBcWMcjaEP2RkRJxhFF0gIfNv7F4gmMFJEgTeT8gu4iUIEu+qrxj0qGivh27yk3o I242HTXe1D6SsPS7aR+5xyzdnWbSlWknV2RcB8EPsntcpn6D5g1hmiJzUi+z2UB5WJH+ HInA== 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 g3-v6si1542879plp.662.2018.03.27.11.08.05; Tue, 27 Mar 2018 11:08:19 -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 S1752665AbeC0Q3b (ORCPT + 99 others); Tue, 27 Mar 2018 12:29:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41346 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751824AbeC0Q32 (ORCPT ); Tue, 27 Mar 2018 12:29: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 615681094; Tue, 27 Mar 2018 16:29: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.4 26/43] brcmfmac: fix P2P_DEVICE ethernet address generation Date: Tue, 27 Mar 2018 18:27:30 +0200 Message-Id: <20180327162717.887133241@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162716.407986916@linuxfoundation.org> References: <20180327162716.407986916@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.4-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/brcm80211/brcmfmac/p2p.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c @@ -461,25 +461,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