Skip to content

Commit

Permalink
mt76: mt7615: fix a possible NULL pointer dereference in mt7615_pm_wa…
Browse files Browse the repository at this point in the history
…ke_work

[ Upstream commit a081de1 ]

Initialize wcid to global_wcid if msta is NULL in mt7615_pm_wake_work
routine since wcid will be dereferenced running mt76_tx()

Fixes: 2b8cdfb ("mt76: mt7615: wake device before pushing frames in mt7615_tx")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
LorenzoBianconi authored and gregkh committed Oct 29, 2020
1 parent 6fd4769 commit 3d20d6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/mediatek/mt76/mt7615/mac.c
Expand Up @@ -1853,12 +1853,13 @@ void mt7615_pm_wake_work(struct work_struct *work)
spin_lock_bh(&dev->pm.txq_lock);
for (i = 0; i < IEEE80211_NUM_ACS; i++) {
struct mt7615_sta *msta = dev->pm.tx_q[i].msta;
struct mt76_wcid *wcid = msta ? &msta->wcid : NULL;
struct ieee80211_sta *sta = NULL;
struct mt76_wcid *wcid;

if (!dev->pm.tx_q[i].skb)
continue;

wcid = msta ? &msta->wcid : &dev->mt76.global_wcid;
if (msta && wcid->sta)
sta = container_of((void *)msta, struct ieee80211_sta,
drv_priv);
Expand Down

0 comments on commit 3d20d6f

Please sign in to comment.