wifi: mac80211: always initialize link_sta with sta
authorJohannes Berg <johannes.berg@intel.com>
Wed, 15 Feb 2023 09:40:41 +0000 (10:40 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 15 Feb 2023 17:27:35 +0000 (18:27 +0100)
When we have multiple interfaces receiving the same frame,
such as a multicast frame, one interface might have a sta
and the other not. In this case, link_sta would be set but
not cleared again.

Always set link_sta, so we keep an invariant that link_sta
and sta are either both set or both not set.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rx.c

index 69aa623163c6d75109ed66ff169d5df71f854ccc..f7fdfe710951faa1c9402cfd8d71ced290864f3e 100644 (file)
@@ -4125,6 +4125,8 @@ static bool ieee80211_rx_data_set_sta(struct ieee80211_rx_data *rx,
                if (!rx->sdata)
                        rx->sdata = sta->sdata;
                rx->link_sta = &sta->deflink;
+       } else {
+               rx->link_sta = NULL;
        }
 
        if (link_id < 0)