Skip to content

Commit 7d98586

Browse files
committed
sch_qfq: make qfq_qlen_notify() idempotent
jira LE-3845 cve CVE-2025-38350 Rebuild_History Non-Buildable kernel-4.18.0-553.69.1.el8_10 commit-author Cong Wang <[email protected]> commit 55f9eca qfq_qlen_notify() always deletes its class from its active list with list_del_init() _and_ calls qfq_deactivate_agg() when the whole list becomes empty. To make it idempotent, just skip everything when it is not in the active list. Also change other list_del()'s to list_del_init() just to be extra safe. Reported-by: Gerrard Tai <[email protected]> Signed-off-by: Cong Wang <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> (cherry picked from commit 55f9eca) Signed-off-by: Jonathan Maple <[email protected]>
1 parent f8ac26e commit 7d98586

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/sched/sch_qfq.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ static void qfq_deactivate_class(struct qfq_sched *q, struct qfq_class *cl)
352352
struct qfq_aggregate *agg = cl->agg;
353353

354354

355-
list_del(&cl->alist); /* remove from RR queue of the aggregate */
355+
list_del_init(&cl->alist); /* remove from RR queue of the aggregate */
356356
if (list_empty(&agg->active)) /* agg is now inactive */
357357
qfq_deactivate_agg(q, agg);
358358
}
@@ -481,6 +481,7 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
481481
gnet_stats_basic_sync_init(&cl->bstats);
482482
cl->common.classid = classid;
483483
cl->deficit = lmax;
484+
INIT_LIST_HEAD(&cl->alist);
484485

485486
cl->qdisc = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
486487
classid, NULL);
@@ -987,7 +988,7 @@ static struct sk_buff *agg_dequeue(struct qfq_aggregate *agg,
987988
cl->deficit -= (int) len;
988989

989990
if (cl->qdisc->q.qlen == 0) /* no more packets, remove from list */
990-
list_del(&cl->alist);
991+
list_del_init(&cl->alist);
991992
else if (cl->deficit < qdisc_pkt_len(cl->qdisc->ops->peek(cl->qdisc))) {
992993
cl->deficit += agg->lmax;
993994
list_move_tail(&cl->alist, &agg->active);
@@ -1420,6 +1421,8 @@ static void qfq_qlen_notify(struct Qdisc *sch, unsigned long arg)
14201421
struct qfq_sched *q = qdisc_priv(sch);
14211422
struct qfq_class *cl = (struct qfq_class *)arg;
14221423

1424+
if (list_empty(&cl->alist))
1425+
return;
14231426
qfq_deactivate_class(q, cl);
14241427
}
14251428

0 commit comments

Comments
 (0)