mac80211_hwsim: fix secondary MAC address assignment
authorJohannes Berg <johannes.berg@intel.com>
Wed, 21 Mar 2018 08:07:02 +0000 (09:07 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 21 Mar 2018 08:08:45 +0000 (09:08 +0100)
OR'ing in 0x40 before a memcpy() to overwrite the value doesn't
do much good - flip the order of operations are reported and
tested by Jouni.

Fixes: cb1a5bae5684 ("mac80211_hwsim: add permanent mac address option for new radios")
Reported-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/mac80211_hwsim.c

index 7b6c3640a94f4451a2d6f65ad969a5f092ea3ac7..930ddef91093a3594c4a134dc5ce0597c5df1e64 100644 (file)
@@ -2584,8 +2584,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
                addr[4] = idx;
                memcpy(data->addresses[0].addr, addr, ETH_ALEN);
                /* Why need here second address ? */
-               data->addresses[1].addr[0] |= 0x40;
                memcpy(data->addresses[1].addr, addr, ETH_ALEN);
+               data->addresses[1].addr[0] |= 0x40;
                hw->wiphy->n_addresses = 2;
                hw->wiphy->addresses = data->addresses;
                /* possible address clash is checked at hash table insertion */