]> git.ipfire.org Git - people/ms/linux.git/commitdiff
wifi: mac80211: potential NULL dereference in ieee80211_tx_control_port()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 28 Jul 2022 14:25:16 +0000 (17:25 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 25 Aug 2022 08:05:25 +0000 (10:05 +0200)
The ieee80211_lookup_ra_sta() function will sometimes set "sta" to NULL
so add this NULL check to prevent an Oops.

Fixes: 9dd1953846c7 ("wifi: nl80211/mac80211: clarify link ID in control port TX")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YuKcTAyO94YOy0Bu@kili
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/tx.c

index 594bd70ee641a86106034712367d44bb5253745b..bf7fe6cd9dfcad0b7d90cf35cd0bf85ed07ab554 100644 (file)
@@ -5900,7 +5900,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
                 * for MLO STA, the SA should be the AP MLD address, but
                 * the link ID has been selected already
                 */
-               if (sta->sta.mlo)
+               if (sta && sta->sta.mlo)
                        memcpy(ehdr->h_source, sdata->vif.addr, ETH_ALEN);
        }
        rcu_read_unlock();