]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/sched: sch_qfq: Fix null-deref in agg_dequeue
authorXiang Mei <xmei5@asu.edu>
Sat, 5 Jul 2025 21:21:43 +0000 (14:21 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 10 Jul 2025 09:08:35 +0000 (11:08 +0200)
commitdd831ac8221e691e9e918585b1003c7071df0379
tree8af5b853df41c312abd6d5f0bcdc8ad7c5f16a81
parent0fda5ccf5425c7b92eaca868a3fba8a3c9f8b746
net/sched: sch_qfq: Fix null-deref in agg_dequeue

To prevent a potential crash in agg_dequeue (net/sched/sch_qfq.c)
when cl->qdisc->ops->peek(cl->qdisc) returns NULL, we check the return
value before using it, similar to the existing approach in sch_hfsc.c.

To avoid code duplication, the following changes are made:

1. Changed qdisc_warn_nonwc(include/net/pkt_sched.h) into a static
inline function.

2. Moved qdisc_peek_len from net/sched/sch_hfsc.c to
include/net/pkt_sched.h so that sch_qfq can reuse it.

3. Applied qdisc_peek_len in agg_dequeue to avoid crashing.

Signed-off-by: Xiang Mei <xmei5@asu.edu>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Link: https://patch.msgid.link/20250705212143.3982664-1-xmei5@asu.edu
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/net/pkt_sched.h
net/sched/sch_api.c
net/sched/sch_hfsc.c
net/sched/sch_qfq.c