Skip to content

Commit be3618d

Browse files
zhengchaoshaodavem330
authored andcommitted
net/sched: taprio: fix slab-out-of-bounds Read in taprio_dequeue_from_txq
As shown in [1], out-of-bounds access occurs in two cases: 1)when the qdisc of the taprio type is used to replace the previously configured taprio, count and offset in tc_to_txq can be set to 0. In this case, the value of *txq in taprio_next_tc_txq() will increases continuously. When the number of accessed queues exceeds the number of queues on the device, out-of-bounds access occurs. 2)When packets are dequeued, taprio can be deleted. In this case, the tc rule of dev is cleared. The count and offset values are also set to 0. In this case, out-of-bounds access is also caused. Now the restriction on the queue number is added. [1] https://groups.google.com/g/syzkaller-bugs/c/_lYOKgkBVMg Fixes: 2f530df ("net/sched: taprio: give higher priority to higher TCs in software dequeue mode") Reported-by: [email protected] Signed-off-by: Zhengchao Shao <[email protected]> Tested-by: Pedro Tammela <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c0e4893 commit be3618d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/sched/sch_taprio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,9 @@ static struct sk_buff *taprio_dequeue_tc_priority(struct Qdisc *sch,
797797

798798
taprio_next_tc_txq(dev, tc, &q->cur_txq[tc]);
799799

800+
if (q->cur_txq[tc] >= dev->num_tx_queues)
801+
q->cur_txq[tc] = first_txq;
802+
800803
if (skb)
801804
return skb;
802805
} while (q->cur_txq[tc] != first_txq);

0 commit comments

Comments
 (0)