Skip to content
Commit be3618d9 authored by Zhengchao Shao's avatar Zhengchao Shao Committed by David S. Miller
Browse files

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: 2f530df7

 ("net/sched: taprio: give higher priority to higher TCs in software dequeue mode")
Reported-by: default avatar <syzbot+04afcb3d2c840447559a@syzkaller.appspotmail.com>
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Tested-by: default avatarPedro Tammela <pctammela@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c0e48937
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment