Commit 611ff1b
xen: privcmd: Fix possible access to a freed kirqfd instance
Nothing prevents simultaneous ioctl calls to privcmd_irqfd_assign() and
privcmd_irqfd_deassign(). If that happens, it is possible that a kirqfd
created and added to the irqfds_list by privcmd_irqfd_assign() may get
removed by another thread executing privcmd_irqfd_deassign(), while the
former is still using it after dropping the locks.
This can lead to a situation where an already freed kirqfd instance may
be accessed and cause kernel oops.
Use SRCU locking to prevent the same, as is done for the KVM
implementation for irqfds.
Reported-by: Al Viro <[email protected]>
Suggested-by: Paolo Bonzini <[email protected]>
Signed-off-by: Viresh Kumar <[email protected]>
Reviewed-by: Juergen Gross <[email protected]>
Link: https://lore.kernel.org/r/9e884af1f1f842eacbb7afc5672c8feb4dea7f3f.1718703669.git.viresh.kumar@linaro.org
Signed-off-by: Juergen Gross <[email protected]>1 parent 1c68259 commit 611ff1b
1 file changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
847 | 848 | | |
848 | 849 | | |
849 | 850 | | |
| 851 | + | |
850 | 852 | | |
851 | 853 | | |
852 | 854 | | |
| |||
874 | 876 | | |
875 | 877 | | |
876 | 878 | | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
877 | 882 | | |
878 | 883 | | |
879 | 884 | | |
| |||
936 | 941 | | |
937 | 942 | | |
938 | 943 | | |
939 | | - | |
| 944 | + | |
940 | 945 | | |
941 | 946 | | |
942 | 947 | | |
| |||
982 | 987 | | |
983 | 988 | | |
984 | 989 | | |
| 990 | + | |
985 | 991 | | |
986 | 992 | | |
987 | 993 | | |
| |||
993 | 999 | | |
994 | 1000 | | |
995 | 1001 | | |
| 1002 | + | |
| 1003 | + | |
996 | 1004 | | |
997 | 1005 | | |
998 | 1006 | | |
| |||
0 commit comments