Commit 5e28d5a
net/sched: sch_qfq: Fix race condition on qfq_aggregate
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>1 parent 7727ec1 commit 5e28d5a
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 | | |
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
450 | 454 | | |
451 | | - | |
| 455 | + | |
452 | 456 | | |
453 | 457 | | |
454 | 458 | | |
| |||
555 | 559 | | |
556 | 560 | | |
557 | 561 | | |
| 562 | + | |
558 | 563 | | |
559 | 564 | | |
560 | 565 | | |
561 | | - | |
562 | 566 | | |
563 | 567 | | |
564 | 568 | | |
| |||
625 | 629 | | |
626 | 630 | | |
627 | 631 | | |
| 632 | + | |
628 | 633 | | |
629 | 634 | | |
630 | 635 | | |
| |||
633 | 638 | | |
634 | 639 | | |
635 | 640 | | |
636 | | - | |
637 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
638 | 648 | | |
639 | 649 | | |
640 | 650 | | |
| |||
651 | 661 | | |
652 | 662 | | |
653 | 663 | | |
| 664 | + | |
654 | 665 | | |
655 | 666 | | |
| 667 | + | |
656 | 668 | | |
657 | 669 | | |
658 | 670 | | |
| |||
0 commit comments