]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/sched: sch_qfq: Fix race condition on qfq_aggregate
authorXiang Mei <xmei5@asu.edu>
Thu, 10 Jul 2025 10:09:42 +0000 (03:09 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jul 2025 06:53:17 +0000 (08:53 +0200)
commitfbe48f06e64134dfeafa89ad23387f66ebca3527
treef1efa6daee6b4e3a406c755384133b58b192499a
parent21033b49cf094ebd9c545ea7b9bed04d084ce84d
net/sched: sch_qfq: Fix race condition on qfq_aggregate

[ Upstream commit 5e28d5a3f774f118896aec17a3a20a9c5c9dfc64 ]

A race condition can occur when 'agg' is modified in qfq_change_agg
(called during qfq_enqueue) while other threads access it
concurrently. For example, qfq_dump_class may trigger a NULL
dereference, and qfq_delete_class may cause a use-after-free.

This patch addresses the issue by:

1. Moved qfq_destroy_class into the critical section.

2. Added sch_tree_lock protection to qfq_dump_class and
qfq_dump_class_stats.

Fixes: 462dbc9101ac ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")
Signed-off-by: Xiang Mei <xmei5@asu.edu>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/sch_qfq.c