Commit 847748f
hsr: hold rcu and dev lock for hsr_get_port_ndev
hsr_get_port_ndev calls hsr_for_each_port, which need to hold rcu lock.
On the other hand, before return the port device, we need to hold the
device reference to avoid UaF in the caller function.
Suggested-by: Paolo Abeni <[email protected]>
Fixes: 9c10dd8 ("net: hsr: Create and export hsr_get_port_ndev()")
Signed-off-by: Hangbin Liu <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>1 parent 393c841 commit 847748f
File tree
2 files changed
+20
-7
lines changed- drivers/net/ethernet/ti/icssg
- net/hsr
2 files changed
+20
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
657 | | - | |
| 657 | + | |
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
666 | | - | |
667 | | - | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
668 | 670 | | |
| 671 | + | |
669 | 672 | | |
670 | 673 | | |
| 674 | + | |
671 | 675 | | |
672 | 676 | | |
673 | 677 | | |
| |||
679 | 683 | | |
680 | 684 | | |
681 | 685 | | |
682 | | - | |
| 686 | + | |
683 | 687 | | |
684 | 688 | | |
685 | 689 | | |
| |||
688 | 692 | | |
689 | 693 | | |
690 | 694 | | |
691 | | - | |
692 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
693 | 699 | | |
| 700 | + | |
694 | 701 | | |
695 | 702 | | |
| 703 | + | |
696 | 704 | | |
697 | 705 | | |
698 | 706 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
675 | 675 | | |
676 | 676 | | |
677 | 677 | | |
| 678 | + | |
678 | 679 | | |
679 | | - | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
680 | 683 | | |
| 684 | + | |
| 685 | + | |
681 | 686 | | |
682 | 687 | | |
683 | 688 | | |
| |||
0 commit comments