Repository navigation
Commit f3cdbe3
tcmu: fix crash during device removal
We currently do
tcmu_free_device ->tcmu_netlink_event(TCMU_CMD_REMOVED_DEVICE) ->
uio_unregister_device -> kfree(tcmu_dev).
The problem is that the kernel does not wait for userspace to
do the close() on the uio device before freeing the tcmu_dev.
We can then hit a race where the kernel frees the tcmu_dev before
userspace does close() and so when close() -> release -> tcmu_release
is done, we try to access a freed tcmu_dev.
This patch made over the target-pending master branch moves the freeing
of the tcmu_dev to when the last reference has been dropped.
This also fixes a leak where if tcmu_configure_device was not called on a
device we did not free udev->name which was allocated at tcmu_alloc_device time.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>1 parent 4ff83da commit f3cdbe3
1 file changed
Lines changed: 33 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
969 | 969 | | |
970 | 970 | | |
971 | 971 | | |
| 972 | + | |
972 | 973 | | |
973 | 974 | | |
974 | 975 | | |
| |||
1145 | 1146 | | |
1146 | 1147 | | |
1147 | 1148 | | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
1148 | 1167 | | |
1149 | 1168 | | |
1150 | 1169 | | |
1151 | 1170 | | |
1152 | 1171 | | |
1153 | 1172 | | |
1154 | 1173 | | |
1155 | | - | |
| 1174 | + | |
| 1175 | + | |
1156 | 1176 | | |
1157 | 1177 | | |
1158 | 1178 | | |
| |||
1272 | 1292 | | |
1273 | 1293 | | |
1274 | 1294 | | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
1275 | 1301 | | |
1276 | 1302 | | |
1277 | 1303 | | |
| |||
1284 | 1310 | | |
1285 | 1311 | | |
1286 | 1312 | | |
| 1313 | + | |
1287 | 1314 | | |
1288 | 1315 | | |
1289 | 1316 | | |
1290 | 1317 | | |
1291 | 1318 | | |
| 1319 | + | |
1292 | 1320 | | |
1293 | 1321 | | |
1294 | 1322 | | |
| |||
1302 | 1330 | | |
1303 | 1331 | | |
1304 | 1332 | | |
1305 | | - | |
1306 | | - | |
1307 | | - | |
1308 | | - | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
1313 | 1333 | | |
1314 | 1334 | | |
1315 | 1335 | | |
| |||
1364 | 1384 | | |
1365 | 1385 | | |
1366 | 1386 | | |
1367 | | - | |
1368 | | - | |
1369 | 1387 | | |
1370 | | - | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
1371 | 1391 | | |
1372 | 1392 | | |
1373 | 1393 | | |
| |||
0 commit comments