Skip to content

Commit 17cf481

Browse files
committed
sch_drr: make drr_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 df00859 drr_qlen_notify() always deletes the DRR class from its active list with list_del(), therefore, it is not idempotent and not friendly to its callers, like fq_codel_dequeue(). Let's make it idempotent to ease qdisc_tree_reduce_backlog() callers' life. 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 df00859) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 7d98586 commit 17cf481

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/sched/sch_drr.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
109109
return -ENOBUFS;
110110

111111
gnet_stats_basic_sync_init(&cl->bstats);
112+
INIT_LIST_HEAD(&cl->alist);
112113
cl->common.classid = classid;
113114
cl->quantum = quantum;
114115
cl->qdisc = qdisc_create_dflt(sch->dev_queue,
@@ -231,7 +232,7 @@ static void drr_qlen_notify(struct Qdisc *csh, unsigned long arg)
231232
{
232233
struct drr_class *cl = (struct drr_class *)arg;
233234

234-
list_del(&cl->alist);
235+
list_del_init(&cl->alist);
235236
}
236237

237238
static int drr_dump_class(struct Qdisc *sch, unsigned long arg,
@@ -392,7 +393,7 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch)
392393
if (unlikely(skb == NULL))
393394
goto out;
394395
if (cl->qdisc->q.qlen == 0)
395-
list_del(&cl->alist);
396+
list_del_init(&cl->alist);
396397

397398
bstats_update(&cl->bstats, skb);
398399
qdisc_bstats_update(sch, skb);
@@ -433,7 +434,7 @@ static void drr_reset_qdisc(struct Qdisc *sch)
433434
for (i = 0; i < q->clhash.hashsize; i++) {
434435
hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
435436
if (cl->qdisc->q.qlen)
436-
list_del(&cl->alist);
437+
list_del_init(&cl->alist);
437438
qdisc_reset(cl->qdisc);
438439
}
439440
}

0 commit comments

Comments
 (0)