Commit 7e348b3
user_events: Prevent dyn_event delete racing with ioctl add/delete
Find user_events always while under the event_mutex and before leaving
the lock, add a ref count to the user_event. This ensures that all paths
under the event_mutex that check the ref counts will be synchronized.
The ioctl add/delete paths are protected by the reg_mutex. However,
dyn_event is only protected by the event_mutex. The dyn_event delete
path cannot acquire reg_mutex, since that could cause a deadlock between
the ioctl delete case acquiring event_mutex after acquiring the reg_mutex.
Link: https://lkml.kernel.org/r/20220310001141.1660-1-beaub@linux.microsoft.com
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>1 parent 3a73333 commit 7e348b3
1 file changed
Lines changed: 40 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| |||
593 | 595 | | |
594 | 596 | | |
595 | 597 | | |
596 | | - | |
| 598 | + | |
| 599 | + | |
597 | 600 | | |
| 601 | + | |
598 | 602 | | |
599 | 603 | | |
600 | 604 | | |
| |||
883 | 887 | | |
884 | 888 | | |
885 | 889 | | |
| 890 | + | |
886 | 891 | | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
887 | 896 | | |
888 | 897 | | |
889 | 898 | | |
| |||
1050 | 1059 | | |
1051 | 1060 | | |
1052 | 1061 | | |
| 1062 | + | |
1053 | 1063 | | |
1054 | 1064 | | |
1055 | 1065 | | |
1056 | 1066 | | |
1057 | 1067 | | |
1058 | 1068 | | |
1059 | 1069 | | |
1060 | | - | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
1061 | 1076 | | |
1062 | 1077 | | |
1063 | 1078 | | |
| |||
1121 | 1136 | | |
1122 | 1137 | | |
1123 | 1138 | | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1124 | 1143 | | |
1125 | 1144 | | |
1126 | 1145 | | |
| |||
1147 | 1166 | | |
1148 | 1167 | | |
1149 | 1168 | | |
1150 | | - | |
1151 | | - | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
1152 | 1174 | | |
1153 | | - | |
1154 | 1175 | | |
1155 | | - | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
1156 | 1184 | | |
1157 | 1185 | | |
1158 | 1186 | | |
| |||
1340 | 1368 | | |
1341 | 1369 | | |
1342 | 1370 | | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
1343 | 1374 | | |
1344 | 1375 | | |
1345 | 1376 | | |
| |||
1364 | 1395 | | |
1365 | 1396 | | |
1366 | 1397 | | |
| 1398 | + | |
| 1399 | + | |
1367 | 1400 | | |
| 1401 | + | |
1368 | 1402 | | |
1369 | 1403 | | |
1370 | 1404 | | |
| |||
0 commit comments