This is a note to let you know that I've just added the patch titled net/sched: taprio: fix slab-out-of-bounds Read in taprio_dequeue_from_txq to the 6.3-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-sched-taprio-fix-slab-out-of-bounds-read-in-tapr.patch and it can be found in the queue-6.3 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit f6ee4d45cb95442ed7d9072a6be6ae8e23fdbe02 Author: Zhengchao Shao <shaozhengchao@xxxxxxxxxx> Date: Thu Jun 8 14:27:56 2023 +0800 net/sched: taprio: fix slab-out-of-bounds Read in taprio_dequeue_from_txq [ Upstream commit be3618d9651002cd5ff190dbfc6cf78f03e34e27 ] 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: 2f530df76c8c ("net/sched: taprio: give higher priority to higher TCs in software dequeue mode") Reported-by: syzbot+04afcb3d2c840447559a@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Zhengchao Shao <shaozhengchao@xxxxxxxxxx> Tested-by: Pedro Tammela <pctammela@xxxxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index a6cf56a969421..7190482b52e05 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -795,6 +795,9 @@ static struct sk_buff *taprio_dequeue_tc_priority(struct Qdisc *sch, taprio_next_tc_txq(dev, tc, &q->cur_txq[tc]); + if (q->cur_txq[tc] >= dev->num_tx_queues) + q->cur_txq[tc] = first_txq; + if (skb) return skb; } while (q->cur_txq[tc] != first_txq);