Skip to content

Commit 49fba87

Browse files
committed
wifi: mt76: fix linked list corruption
Never leave scheduled wcid entries on the temporary on-stack list Fixes: 0b3be9d ("wifi: mt76: add separate tx scheduling queue for off-channel tx") Link: https://patch.msgid.link/[email protected] Signed-off-by: Felix Fietkau <[email protected]>
1 parent bdeac78 commit 49fba87

File tree

1 file changed

+3
-5
lines changed
  • drivers/net/wireless/mediatek/mt76

1 file changed

+3
-5
lines changed

drivers/net/wireless/mediatek/mt76/tx.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ mt76_txq_schedule_pending_wcid(struct mt76_phy *phy, struct mt76_wcid *wcid,
646646
static void mt76_txq_schedule_pending(struct mt76_phy *phy)
647647
{
648648
LIST_HEAD(tx_list);
649+
int ret = 0;
649650

650651
if (list_empty(&phy->tx_list))
651652
return;
@@ -657,13 +658,13 @@ static void mt76_txq_schedule_pending(struct mt76_phy *phy)
657658
list_splice_init(&phy->tx_list, &tx_list);
658659
while (!list_empty(&tx_list)) {
659660
struct mt76_wcid *wcid;
660-
int ret;
661661

662662
wcid = list_first_entry(&tx_list, struct mt76_wcid, tx_list);
663663
list_del_init(&wcid->tx_list);
664664

665665
spin_unlock(&phy->tx_lock);
666-
ret = mt76_txq_schedule_pending_wcid(phy, wcid, &wcid->tx_offchannel);
666+
if (ret >= 0)
667+
ret = mt76_txq_schedule_pending_wcid(phy, wcid, &wcid->tx_offchannel);
667668
if (ret >= 0 && !phy->offchannel)
668669
ret = mt76_txq_schedule_pending_wcid(phy, wcid, &wcid->tx_pending);
669670
spin_lock(&phy->tx_lock);
@@ -672,9 +673,6 @@ static void mt76_txq_schedule_pending(struct mt76_phy *phy)
672673
!skb_queue_empty(&wcid->tx_offchannel) &&
673674
list_empty(&wcid->tx_list))
674675
list_add_tail(&wcid->tx_list, &phy->tx_list);
675-
676-
if (ret < 0)
677-
break;
678676
}
679677
spin_unlock(&phy->tx_lock);
680678

0 commit comments

Comments
 (0)