From patchwork Wed Apr 5 22:26:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9665813 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8E13560352 for ; Wed, 5 Apr 2017 22:27:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DFF12522B for ; Wed, 5 Apr 2017 22:27:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7296226E48; Wed, 5 Apr 2017 22:27:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFE0A2522B for ; Wed, 5 Apr 2017 22:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756119AbdDEW1D (ORCPT ); Wed, 5 Apr 2017 18:27:03 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:35815 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752189AbdDEW1C (ORCPT ); Wed, 5 Apr 2017 18:27:02 -0400 Received: by mail-pg0-f53.google.com with SMTP id 81so17190642pgh.2 for ; Wed, 05 Apr 2017 15:27:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=wjE25nCm2e92GjTx1pfmzeEpqWziZH10ErUst9A9cSM=; b=E3s/MApXeNclJcHYvkTgDIpx5pjZ29/15i4Fzv0n01OCQH4khOrvfodJOG8q2CKG0Z Bkp8j6EBDihzRjPs6i0lYsAvHCjOHn+T03OhBLM8zuDLXZnZP55PYyPgIsRxWYQvUlj2 58t7X63IT56wganiiSyiwuux9K5LDiMlBELmw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wjE25nCm2e92GjTx1pfmzeEpqWziZH10ErUst9A9cSM=; b=gqDUrwcxEUlSPaWaMIARoTbJ3/Q8YKzsbchWQN+hD9wpSMZppSJi8ztKmxtkD+dOkS nnnxFPtRkIPCUNL7wsXp5XkQUFj72sonnazifJkCc9psUeNfxJOrZH5p6A3qA1XfNnL3 DJtLdZHA1nbqakYHmjoZgSH7EZgBVfxNgMgNzhV8l5ZqPVgczleaY4bsv/bk6e34W1Q9 Y6tOUReiC1sT0bqzLiUo8RXnjyxVAyvJJoGtgKzPhY1aAxBN7FTMAlLQXK0J+VWyrUtd t0SBjXdUaHauWDHrfFXbjHFkhsAsrF96DSPe07CibaWJLvG8lGIoPAlpbk7J5YwGbuwe mn9A== X-Gm-Message-State: AFeK/H3UwMVeeG1YcNfOIcjnvMz0H6D6RO26ykd0Ze42c7DI/ZAabwXgSN4gq60QLC75oij8 X-Received: by 10.84.234.2 with SMTP id m2mr39652612plk.169.1491431221785; Wed, 05 Apr 2017 15:27:01 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id r82sm32583594pfl.108.2017.04.05.15.27.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Apr 2017 15:27:01 -0700 (PDT) From: Brian Norris To: Nishant Sarmukadam , Ganapathi Bhat , Xinming Hu Cc: , Kalle Valo , Dmitry Torokhov , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Brian Norris Subject: [PATCH] mwifiex: MAC randomization should not be persistent Date: Wed, 5 Apr 2017 15:26:40 -0700 Message-Id: <20170405222640.4494-1-briannorris@chromium.org> X-Mailer: git-send-email 2.12.2.715.g7642488e1d-goog Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nl80211 provides the NL80211_SCAN_FLAG_RANDOM_ADDR for every scan request that should be randomized; the absence of such a flag means we should not randomize. However, mwifiex was stashing the latest randomization request and *always* using it for future scans, even those that didn't set the flag. Let's zero out the randomization info whenever we get a scan request without NL80211_SCAN_FLAG_RANDOM_ADDR. I'd prefer to remove priv->random_mac entirely (and plumb the randomization MAC properly through the call sequence), but the spaghetti is a little difficult to unravel here for me. Fixes: c2a8f0ff9c6c ("mwifiex: support random MAC address for scanning") Signed-off-by: Brian Norris --- Should this be tagged for -stable? drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 1e3bd435a694..2d7e8a372bf1 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2528,9 +2528,11 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, priv->random_mac[i] |= get_random_int() & ~(request->mac_addr_mask[i]); } + ether_addr_copy(user_scan_cfg->random_mac, priv->random_mac); + } else { + eth_zero_addr(priv->random_mac); } - ether_addr_copy(user_scan_cfg->random_mac, priv->random_mac); user_scan_cfg->num_ssids = request->n_ssids; user_scan_cfg->ssid_list = request->ssids;