Skip to contentSkip to conversation

wifi: mac80211: potential NULL dereference in ieee80211_tx_control_port()

PATCH New Dan Carpenter 1 participant 1 message Jul 28, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 net/mac80211/tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tx.c +1 -1
index 45df9932d0ba..fd7e7dd66efc 100644
@@ -5899,7 +5899,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();
Signature · 1 line
2.35.1