]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mwifiex: avoid storing random_mac in private
authorGanapathi Bhat <gbhat@marvell.com>
Mon, 18 Sep 2017 06:55:02 +0000 (12:25 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 20 Sep 2017 12:47:53 +0000 (15:47 +0300)
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 <gbhat@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/cfg80211.c
drivers/net/wireless/marvell/mwifiex/main.h
drivers/net/wireless/marvell/mwifiex/scan.c

index a3d142bdf946a12b6787d142e242b5d5832f2075..f28040c45d863cf38e07e51cbf7841973d44ef2b 100644 (file)
@@ -2529,15 +2529,12 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
        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;
index a76bd797e4544a43abcb5611fb066559bdff0280..a34de8582e91a04341a959b25f8b3be691485c88 100644 (file)
@@ -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];
 };
 
 
index 8838b88cd998ec44ae6b1ea988ff7114cb933532..d7ce7f75ae385da1cc3e8a5d33df34c8788dc64b 100644 (file)
@@ -1946,7 +1946,8 @@ mwifiex_active_scan_req_for_passive_chan(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;