Commit fbe48f0
net/sched: sch_qfq: Fix race condition on qfq_aggregate
[ Upstream commit 5e28d5a ]
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: 462dbc9 ("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>1 parent 21033b4 commit fbe48f0
1 file changed
+21
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
453 | 457 | | |
454 | | - | |
| 458 | + | |
455 | 459 | | |
456 | 460 | | |
457 | 461 | | |
| |||
558 | 562 | | |
559 | 563 | | |
560 | 564 | | |
| 565 | + | |
561 | 566 | | |
562 | 567 | | |
563 | 568 | | |
564 | | - | |
565 | 569 | | |
566 | 570 | | |
567 | 571 | | |
| |||
628 | 632 | | |
629 | 633 | | |
630 | 634 | | |
| 635 | + | |
631 | 636 | | |
632 | 637 | | |
633 | 638 | | |
| |||
636 | 641 | | |
637 | 642 | | |
638 | 643 | | |
639 | | - | |
640 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
641 | 651 | | |
642 | 652 | | |
643 | 653 | | |
| |||
654 | 664 | | |
655 | 665 | | |
656 | 666 | | |
| 667 | + | |
657 | 668 | | |
658 | 669 | | |
| 670 | + | |
659 | 671 | | |
660 | 672 | | |
661 | 673 | | |
| |||
0 commit comments