]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
wifi: mac80211_hwsim: fix link change handling
authorJohannes Berg <johannes.berg@intel.com>
Fri, 19 Aug 2022 12:58:42 +0000 (14:58 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 25 Aug 2022 08:41:27 +0000 (10:41 +0200)
The code for determining which links to update in wmediumd
or virtio was wrong, fix it to remove the deflink only if
there were no old links, and also add the deflink if there
are no other new links.

Fixes: c204d9df0202 ("wifi: mac80211_hwsim: handle links for wmediumd/virtio")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/mac80211_hwsim.c

index 68c7fe9edecc830f22d342cc85d26366a753f114..4fb8f68e5c3b79ebe80f9a481fbdf2447d3abc50 100644 (file)
@@ -2995,10 +2995,15 @@ static int mac80211_hwsim_change_vif_links(struct ieee80211_hw *hw,
                                           u16 old_links, u16 new_links,
                                           struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS])
 {
-       unsigned long rem = old_links & ~new_links ?: BIT(0);
+       unsigned long rem = old_links & ~new_links;
        unsigned long add = new_links & ~old_links;
        int i;
 
+       if (!old_links)
+               rem |= BIT(0);
+       if (!new_links)
+               add |= BIT(0);
+
        for_each_set_bit(i, &rem, IEEE80211_MLD_MAX_NUM_LINKS)
                mac80211_hwsim_config_mac_nl(hw, old[i]->addr, false);