Skip to content

Commit 8693a01

Browse files
committed
net/sched: sch_qfq: Avoid triggering might_sleep in atomic context in qfq_delete_class
jira VULN-89291 cve-bf CVE-2025-38477 commit-author Xiang Mei <xmei5@asu.edu> 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 <dan.carpenter@linaro.org> Signed-off-by: Xiang Mei <xmei5@asu.edu> Link: https://patch.msgid.link/4a04e0cc-a64b-44e7-9213-2880ed641d77@sabinyo.mountain Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://patch.msgid.link/20250717230128.159766-1-xmei5@asu.edu Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit cf074ec) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent b8a042f commit 8693a01

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

net/sched/sch_qfq.c

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

534534
static void qfq_destroy_class(struct Qdisc *sch, struct qfq_class *cl)
535535
{
536-
struct qfq_sched *q = qdisc_priv(sch);
537-
538-
qfq_rm_from_agg(q, cl);
539536
gen_kill_estimator(&cl->rate_est);
540537
qdisc_put(cl->qdisc);
541538
kfree(cl);
@@ -554,10 +551,11 @@ static int qfq_delete_class(struct Qdisc *sch, unsigned long arg,
554551

555552
qdisc_purge_queue(cl->qdisc);
556553
qdisc_class_hash_remove(&q->clhash, &cl->common);
557-
qfq_destroy_class(sch, cl);
554+
qfq_rm_from_agg(q, cl);
558555

559556
sch_tree_unlock(sch);
560557

558+
qfq_destroy_class(sch, cl);
561559
return 0;
562560
}
563561

@@ -1507,6 +1505,7 @@ static void qfq_destroy_qdisc(struct Qdisc *sch)
15071505
for (i = 0; i < q->clhash.hashsize; i++) {
15081506
hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i],
15091507
common.hnode) {
1508+
qfq_rm_from_agg(q, cl);
15101509
qfq_destroy_class(sch, cl);
15111510
}
15121511
}

0 commit comments

Comments
 (0)