Received: by 10.213.65.68 with SMTP id h4csp874235imn; Tue, 27 Mar 2018 10:21:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx48R+u3N+1sEGCSdrPBcOXbXY22AE3iGL7Qkn8kINXsSZKRXz+0jaLSKQvMr+M6VeZfeB4te X-Received: by 2002:a17:902:107:: with SMTP id 7-v6mr187681plb.374.1522171290258; Tue, 27 Mar 2018 10:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522171290; cv=none; d=google.com; s=arc-20160816; b=WI8tDk04p/ua3slWovfgoTwZZOYL1yBrpeG7WZ3fghG/9/2BxGaEjPA7IlE93H3ZBF 0I6/9jsPGJHdAUzst3chUMgv4M3JHQ/q3BavXFIbBpEsHHiTsLTQSwwZN1QkqtboDi/E hB8jxBAsTr7HJbf6oxfvQabUP10g46nLlpiociZbS6G5JLa0n91H2RPnCcx/nPYxvnZN VRU+dAUqMPC5ZqryNo7T01NoUZsvy6fb6hn0IwsWK91KfiHia/jb/fKJtYoeQqv0XqbV b6DJ6ZYFZpTKOPQhed98XwSuTT9y0fw1T9E8dHF/PniQiM+1zHfB+UffhoGium5Gd1wI GMKw== 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=hTuYEBmcIQiL5d1sdARMCcpew6bTAbZHvS0HT9zcibM=; b=zaIMRRxlqVtIQSoQkzwH1iUwGT0GVV5BsHGc0W3r5v+lxW0zsXav050bU++atb6FJm fqd1zHRuDoT4sh0u6ferKLads/4dLDJgX8EMKZJRXsiWxLR0B4EL0B1ZZnG94EucQXZJ YP6pCFO2CrQvN5k+TJlI+ME6DNrebbeqBNaeWJOaJdxJ81bH069xgNwgyK1a9f0ZdR4g ohTD6wAaeQiR6cAn4giPZ0GW6WhjenMMUzK8CynYquUY2KwzFpP7U+S0dfl4v2jmE4S0 t4MfnxF9B5n5fckDoqAT8DN+Ng7dYJmZOCtYoc7Gf583aQDGYFZcXvEOyKY/Nxm8Xq4U l3Kg== 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 k2-v6si1661653plt.413.2018.03.27.10.21.16; Tue, 27 Mar 2018 10:21: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 S1753863AbeC0RUP (ORCPT + 99 others); Tue, 27 Mar 2018 13:20:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46602 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755100AbeC0QiF (ORCPT ); Tue, 27 Mar 2018 12:38:05 -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 6B697FFC; Tue, 27 Mar 2018 16:38:04 +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.14 062/101] brcmfmac: fix P2P_DEVICE ethernet address generation Date: Tue, 27 Mar 2018 18:27:34 +0200 Message-Id: <20180327162753.808256290@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@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.14-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