Commit 6769a0b
media: dvb-core: Fix use-after-free on race condition at dvb_frontend
If the device node of dvb_frontend is open() and the device is
disconnected, many kinds of UAFs may occur when calling close()
on the device node.
The root cause of this is that wake_up() for dvbdev->wait_queue
is implemented in the dvb_frontend_release() function, but
wait_event() is not implemented in the dvb_frontend_stop() function.
So, implement wait_event() function in dvb_frontend_stop() and
add 'remove_mutex' which prevents race condition for 'fe->exit'.
[mchehab: fix a couple of checkpatch warnings and some mistakes at the error handling logic]
Link: https://lore.kernel.org/linux-media/20221117045925.14297-2-imv4bel@gmail.com
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>1 parent ae11c0e commit 6769a0b
2 files changed
Lines changed: 49 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
809 | 809 | | |
810 | 810 | | |
811 | 811 | | |
| 812 | + | |
| 813 | + | |
812 | 814 | | |
813 | 815 | | |
814 | 816 | | |
815 | 817 | | |
816 | | - | |
| 818 | + | |
| 819 | + | |
817 | 820 | | |
| 821 | + | |
818 | 822 | | |
819 | 823 | | |
820 | 824 | | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
821 | 832 | | |
822 | 833 | | |
823 | 834 | | |
| |||
2761 | 2772 | | |
2762 | 2773 | | |
2763 | 2774 | | |
| 2775 | + | |
| 2776 | + | |
2764 | 2777 | | |
2765 | | - | |
2766 | | - | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
2767 | 2782 | | |
2768 | 2783 | | |
2769 | 2784 | | |
2770 | 2785 | | |
2771 | 2786 | | |
2772 | 2787 | | |
2773 | 2788 | | |
2774 | | - | |
| 2789 | + | |
| 2790 | + | |
2775 | 2791 | | |
2776 | 2792 | | |
2777 | 2793 | | |
| |||
2794 | 2810 | | |
2795 | 2811 | | |
2796 | 2812 | | |
2797 | | - | |
2798 | | - | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
2799 | 2817 | | |
2800 | 2818 | | |
2801 | 2819 | | |
| |||
2807 | 2825 | | |
2808 | 2826 | | |
2809 | 2827 | | |
2810 | | - | |
| 2828 | + | |
| 2829 | + | |
2811 | 2830 | | |
2812 | 2831 | | |
2813 | 2832 | | |
| |||
2866 | 2885 | | |
2867 | 2886 | | |
2868 | 2887 | | |
| 2888 | + | |
| 2889 | + | |
2869 | 2890 | | |
2870 | 2891 | | |
2871 | 2892 | | |
| |||
2887 | 2908 | | |
2888 | 2909 | | |
2889 | 2910 | | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
2890 | 2914 | | |
2891 | 2915 | | |
2892 | 2916 | | |
| |||
2897 | 2921 | | |
2898 | 2922 | | |
2899 | 2923 | | |
| 2924 | + | |
| 2925 | + | |
2900 | 2926 | | |
2901 | 2927 | | |
2902 | 2928 | | |
| |||
2918 | 2944 | | |
2919 | 2945 | | |
2920 | 2946 | | |
2921 | | - | |
2922 | | - | |
2923 | 2947 | | |
2924 | 2948 | | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
2925 | 2959 | | |
2926 | 2960 | | |
2927 | 2961 | | |
| |||
3022 | 3056 | | |
3023 | 3057 | | |
3024 | 3058 | | |
| 3059 | + | |
3025 | 3060 | | |
3026 | 3061 | | |
3027 | 3062 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
689 | | - | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
690 | 693 | | |
691 | 694 | | |
692 | 695 | | |
| |||
704 | 707 | | |
705 | 708 | | |
706 | 709 | | |
| 710 | + | |
707 | 711 | | |
708 | 712 | | |
709 | 713 | | |
| |||
0 commit comments