From patchwork Mon Sep 18 06:55:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapathi Bhat X-Patchwork-Id: 9955573 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 433DC60208 for ; Mon, 18 Sep 2017 06:59:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34F0A28B78 for ; Mon, 18 Sep 2017 06:59:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29C5728B8F; Mon, 18 Sep 2017 06:59:52 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 003DD28B7C for ; Mon, 18 Sep 2017 06:59:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752408AbdIRG6s (ORCPT ); Mon, 18 Sep 2017 02:58:48 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:38925 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752346AbdIRG6r (ORCPT ); Mon, 18 Sep 2017 02:58:47 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8I6t4MC023992; Sun, 17 Sep 2017 23:58:46 -0700 Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2d13feeav0-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 17 Sep 2017 23:58:46 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sun, 17 Sep 2017 23:58:44 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Sun, 17 Sep 2017 23:58:44 -0700 Received: from localhost (gbhat-thinkpad-t430.marvell.com [10.31.130.81]) by maili.marvell.com (Postfix) with ESMTP id 0C7833F703F; Sun, 17 Sep 2017 23:58:43 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by localhost (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id v8I6u8PT010379; Mon, 18 Sep 2017 12:26:08 +0530 Received: (from root@localhost) by localhost (8.14.4/8.14.4/Submit) id v8I6u7Ef010378; Mon, 18 Sep 2017 12:26:07 +0530 From: Ganapathi Bhat To: CC: Brian Norris , Cathy Luo , Xinming Hu , Zhiyuan Yang , James Cao , Mangesh Malusare , Ganapathi Bhat Subject: [PATCH] mwifiex: avoid storing random_mac in private Date: Mon, 18 Sep 2017 12:25:02 +0530 Message-ID: <1505717702-10342-1-git-send-email-gbhat@marvell.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-18_01:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709180101 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 Application will keep track of whether MAC address randomization is enabled or not during scan. But at present driver is storing 'random_mac' in mwifiex_private which implies even after scan is done driver has some reference to the earlier 'scan request'. To avoid this, make use of 'mac_addr' variable in 'scan_request' to store 'random_mac'. This structure will be freed by cfg80211 once scan is done. Signed-off-by: Ganapathi Bhat Reviewed-by: Brian Norris --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 11 ++++------- drivers/net/wireless/marvell/mwifiex/main.h | 1 - drivers/net/wireless/marvell/mwifiex/scan.c | 3 ++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index ad1ebd8..84c1518 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2529,15 +2529,12 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv, priv->scan_request = request; if (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { - ether_addr_copy(priv->random_mac, request->mac_addr); for (i = 0; i < ETH_ALEN; i++) { - priv->random_mac[i] &= request->mac_addr_mask[i]; - priv->random_mac[i] |= get_random_int() & - ~(request->mac_addr_mask[i]); + request->mac_addr[i] &= request->mac_addr_mask[i]; + request->mac_addr[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, request->mac_addr); } user_scan_cfg->num_ssids = request->n_ssids; diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index a76bd79..a34de85 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -680,7 +680,6 @@ struct mwifiex_private { struct mwifiex_user_scan_chan hidden_chan[MWIFIEX_USER_SCAN_CHAN_MAX]; u8 assoc_resp_ht_param; bool ht_param_present; - u8 random_mac[ETH_ALEN]; }; diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c index c9d41ed..cddf412 100644 --- a/drivers/net/wireless/marvell/mwifiex/scan.c +++ b/drivers/net/wireless/marvell/mwifiex/scan.c @@ -1948,7 +1948,8 @@ static void mwifiex_complete_scan(struct mwifiex_private *priv) adapter->active_scan_triggered = true; if (priv->scan_request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) - ether_addr_copy(user_scan_cfg->random_mac, priv->random_mac); + ether_addr_copy(user_scan_cfg->random_mac, + priv->scan_request->mac_addr); user_scan_cfg->num_ssids = priv->scan_request->n_ssids; user_scan_cfg->ssid_list = priv->scan_request->ssids;