Victor Nogueira
097f6fc7b1
net/sched: sch_fq_codel: Do not call qdisc_tree_reduce_backlog during peek before restoring qlen
Whenever fq_codel drops packets during peek, it calls
qdisc_tree_reduce_backlog. An issue arises because it calls
qdisc_tree_reduce_backlog before it reincrements the qlen. If qlen drops
to zero, but peek returns an skb, the parent's qlen_notify callback will be
executed even though fq_codel still has 1 packet on the queue and, thus,
will mistakenly deactivate the parent's class causing issues like a recent
report [1] and a wild memory access in qfq:
[ 29.371146][ T360] Oops: general protection fault, probably for non-canonical address 0xfbd59c0000000024: 0000 [#1] SMP KASAN NOPTI
[ 29.371666][ T360] KASAN: maybe wild-memory-access in range [0xdead000000000120-0xdead000000000127]
[ 29.371987][ T360] CPU: 6 UID: 0 PID: 360 Comm: tc Not tainted 7.1.0-rc5-00285-gc530e5b2dbc6-dirty #82 PREEMPT(full)
[ 29.372384][ T360] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 29.372620][ T360] RIP: 0010:qfq_deactivate_agg (include/linux/list.h:1029 (discriminator 2) include/linux/list.h:1043 (discriminator 2) net/sched/sch_qfq.c:1369 (discriminator 2) net/sched/sch_qfq.c:1395 (discriminator 2)) sch_qfq
[ 29.373544][ T360] RSP: 0018:ffff888102417370 EFLAGS: 00010216
[ 29.373800][ T360] RAX: 0000000000000000 RBX: ffff88811224d568 RCX: dffffc0000000000
[ 29.374079][ T360] RDX: 1ffff11021fe1543 RSI: ffff88810ff0aa00 RDI: dffffc0000000000
[ 29.374368][ T360] RBP: ffff88811224c280 R08: dead000000000122 R09: 1bd5a00000000024
[ 29.374649][ T360] R10: fffffbfff7940329 R11: fffffbfff7940329 R12: 0000000000000000
[ 29.374926][ T360] R13: dead000000000100 R14: ffff88811224d580 R15: ffff88811224d578
[ 29.375207][ T360] FS: 00007f5b794e5780(0000) GS:ffff88815d1e9000(0000) knlGS:0000000000000000
[ 29.375545][ T360] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 29.375823][ T360] CR2: 000055ffb091f000 CR3: 000000010a305000 CR4: 0000000000750ef0
[ 29.376103][ T360] PKRU: 55555554
[ 29.376258][ T360] Call Trace:
[ 29.376401][ T360] <TASK>
...
[ 29.376885][ T360] qfq_reset_qdisc (net/sched/sch_qfq.c:357 net/sched/sch_qfq.c:1487) sch_qfq
[ 29.377074][ T360] qdisc_reset (net/sched/sch_generic.c:1057)
[ 29.377414][ T360] __qdisc_destroy (net/sched/sch_generic.c:1096)
[ 29.377600][ T360] qdisc_graft (net/sched/sch_api.c:1062 net/sched/sch_api.c:1053 net/sched/sch_api.c:1159)
[ 29.378593][ T360] tc_get_qdisc (net/sched/sch_api.c:1528 net/sched/sch_api.c:1556)
Fix this by only calling qdisc_tree_reduce_backlog in peek after the
qlen is restored.
[1] http://lore.kernel.org/netdev/CAN2cbVe79oj0O9==m4+4x3v+O+qzRagA=2=wkrp9i9=CqYvyZA@mail.gmail.com/
Fixes: 342debc121 ("codel: remove sch->q.qlen check before qdisc_tree_reduce_backlog()")
Reported-by: Anirudh Gupta <anirudhrudr@gmail.com>
Closes: https://lore.kernel.org/netdev/CAN2cbVe79oj0O9==m4+4x3v+O+qzRagA=2=wkrp9i9=CqYvyZA@mail.gmail.com/
Tested-by: Anirudh Gupta <anirudhrudr@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Link: https://patch.msgid.link/20260610192855.3121513-2-victor@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-06-12 17:20:53 -07:00
..
2026-06-11 15:27:07 -07:00
2026-04-16 02:57:01 +00:00
2026-06-04 08:52:41 -07:00
2026-04-23 12:13:57 +02:00
2026-06-03 18:08:58 -07:00
2026-06-12 16:33:36 -07:00
2026-05-19 10:43:54 +02:00
2026-06-03 11:24:12 -04:00
2026-04-12 15:42:57 -07:00
2026-06-11 15:16:12 -07:00
2026-04-14 18:36:10 -07:00
2026-05-12 21:00:59 +02:00
2026-06-11 15:57:39 -07:00
2026-06-01 19:54:52 -07:00
2026-04-16 19:10:48 -07:00
2026-03-16 19:29:45 -07:00
2026-05-27 17:42:09 -07:00
2026-05-28 13:35:32 +02:00
2026-06-02 12:04:52 -07:00
2026-06-04 08:51:32 -07:00
2026-06-12 16:18:39 -07:00
2026-06-11 12:30:00 +02:00
2026-05-22 17:40:32 -07:00
2026-05-07 09:31:10 +02:00
2026-06-01 19:40:46 -07:00
2026-04-23 11:40:39 -07:00
2026-06-02 13:26:33 +02:00
2026-03-16 19:29:45 -07:00
2026-04-30 13:36:47 -07:00
2026-04-02 11:03:13 -07:00
2026-06-03 19:04:27 -07:00
2026-06-10 18:00:19 +02:00
2026-06-05 19:05:06 -07:00
2026-05-22 17:11:09 -07:00
2026-05-07 12:42:09 +02:00
2026-06-08 20:13:02 -07:00
2026-04-22 20:16:34 -07:00
2026-06-08 17:37:07 -07:00
2026-05-04 19:25:14 -07:00
2026-06-08 18:45:38 -07:00
2026-06-10 08:18:16 -07:00
2026-04-07 12:35:04 +02:00
2026-06-12 16:48:55 -07:00
2026-06-12 17:20:53 -07:00
2026-06-11 15:18:08 -07:00
2026-05-20 16:34:20 -07:00
2026-05-22 17:38:02 -07:00
2026-04-14 12:37:00 +02:00
2026-05-26 13:49:13 -07:00
2026-03-19 13:14:00 +01:00
2026-06-11 16:01:16 -07:00
2026-05-14 18:19:44 -07:00
2026-06-03 18:52:25 -07:00
2026-06-04 13:08:02 +02:00
2026-06-03 13:25:19 +02:00
2026-04-13 12:19:01 -07:00
2026-06-03 17:45:42 -07:00
2026-06-05 13:20:03 +02:00
2026-04-23 10:24:02 -07:00
2026-04-23 10:24:02 -07:00
2026-06-09 18:32:08 -07:00