Skip to content

Commit 9a068aa

Browse files
committed
net/sched: sch_qfq: Avoid triggering might_sleep in atomic context in qfq_delete_class
jira VULN-89289 jira VULN-89290 cve-bf CVE-2025-38477 commit-author Xiang Mei <[email protected]> commit cf074ec might_sleep could be trigger in the atomic context in qfq_delete_class. qfq_destroy_class was moved into atomic context locked by sch_tree_lock to avoid a race condition bug on qfq_aggregate. However, might_sleep could be triggered by qfq_destroy_class, which introduced sleeping in atomic context (path: qfq_destroy_class->qdisc_put->__qdisc_destroy->lockdep_unregister_key ->might_sleep). Considering the race is on the qfq_aggregate objects, keeping qfq_rm_from_agg in the lock but moving the left part out can solve this issue. Fixes: 5e28d5a ("net/sched: sch_qfq: Fix race condition on qfq_aggregate") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Xiang Mei <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Cong Wang <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> (cherry picked from commit cf074ec) Signed-off-by: Jonathan Maple <[email protected]>
1 parent c1bf840 commit 9a068aa

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

net/sched/sch_qfq.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,6 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
537537

538538
static void qfq_destroy_class(struct Qdisc *sch, struct qfq_class *cl)
539539
{
540-
struct qfq_sched *q = qdisc_priv(sch);
541-
542-
qfq_rm_from_agg(q, cl);
543540
gen_kill_estimator(&cl->rate_est);
544541
qdisc_put(cl->qdisc);
545542
kfree(cl);
@@ -558,10 +555,11 @@ static int qfq_delete_class(struct Qdisc *sch, unsigned long arg,
558555

559556
qdisc_purge_queue(cl->qdisc);
560557
qdisc_class_hash_remove(&q->clhash, &cl->common);
561-
qfq_destroy_class(sch, cl);
558+
qfq_rm_from_agg(q, cl);
562559

563560
sch_tree_unlock(sch);
564561

562+
qfq_destroy_class(sch, cl);
565563
return 0;
566564
}
567565

@@ -1502,6 +1500,7 @@ static void qfq_destroy_qdisc(struct Qdisc *sch)
15021500
for (i = 0; i < q->clhash.hashsize; i++) {
15031501
hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i],
15041502
common.hnode) {
1503+
qfq_rm_from_agg(q, cl);
15051504
qfq_destroy_class(sch, cl);
15061505
}
15071506
}

0 commit comments

Comments
 (0)