diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-07-28 16:25:16 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2022-08-25 10:05:25 +0200 |
commit | 55f0a4894484e8d6ddf662f5aebbf3b4cb028541 (patch) | |
tree | af5236022765bb6604de0758f5ef28e333cc09fc /net | |
parent | wifi: cfg80211: debugfs: fix return type in ht40allow_map_read() (diff) | |
download | linux-55f0a4894484e8d6ddf662f5aebbf3b4cb028541.tar.xz linux-55f0a4894484e8d6ddf662f5aebbf3b4cb028541.zip |
wifi: mac80211: potential NULL dereference in ieee80211_tx_control_port()
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/tx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 594bd70ee641..bf7fe6cd9dfc 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -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(); |