Commit ee40552
loop: don't change loop device under exclusive opener in loop_set_status
loop_set_status() is allowed to change the loop device while there
are other openers of the device, even exclusive ones.
In this case, it causes a KASAN: slab-out-of-bounds Read in
ext4_search_dir(), since when looking for an entry in an inlined
directory, e_value_offs is changed underneath the filesystem by
loop_set_status().
Fix the problem by forbidding loop_set_status() from modifying the loop
device while there are exclusive openers of the device. This is similar
to the fix in loop_configure() by commit 33ec3e5 ("loop: Don't
change loop device under exclusive opener") alongside commit ecbe6bc
("block: use bd_prepare_to_claim directly in the loop driver").
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=3ee481e21fd75e14c397
Tested-by: [email protected]
Signed-off-by: Raphael Pinsonneault-Thibeault <[email protected]>1 parent 4458758 commit ee40552
1 file changed
+30
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1226 | 1226 | | |
1227 | 1227 | | |
1228 | 1228 | | |
1229 | | - | |
| 1229 | + | |
| 1230 | + | |
1230 | 1231 | | |
1231 | 1232 | | |
1232 | 1233 | | |
1233 | 1234 | | |
1234 | 1235 | | |
1235 | 1236 | | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
1236 | 1247 | | |
1237 | 1248 | | |
1238 | 1249 | | |
| |||
1274 | 1285 | | |
1275 | 1286 | | |
1276 | 1287 | | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
1277 | 1291 | | |
1278 | 1292 | | |
1279 | 1293 | | |
| |||
1353 | 1367 | | |
1354 | 1368 | | |
1355 | 1369 | | |
1356 | | - | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
1357 | 1373 | | |
1358 | 1374 | | |
1359 | 1375 | | |
1360 | 1376 | | |
1361 | 1377 | | |
1362 | 1378 | | |
1363 | 1379 | | |
1364 | | - | |
| 1380 | + | |
1365 | 1381 | | |
1366 | 1382 | | |
1367 | 1383 | | |
1368 | | - | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
1369 | 1387 | | |
1370 | 1388 | | |
1371 | 1389 | | |
1372 | 1390 | | |
1373 | 1391 | | |
1374 | | - | |
| 1392 | + | |
1375 | 1393 | | |
1376 | 1394 | | |
1377 | 1395 | | |
| |||
1550 | 1568 | | |
1551 | 1569 | | |
1552 | 1570 | | |
1553 | | - | |
| 1571 | + | |
1554 | 1572 | | |
1555 | 1573 | | |
1556 | 1574 | | |
1557 | 1575 | | |
1558 | 1576 | | |
1559 | 1577 | | |
1560 | | - | |
| 1578 | + | |
1561 | 1579 | | |
1562 | 1580 | | |
1563 | 1581 | | |
| |||
1651 | 1669 | | |
1652 | 1670 | | |
1653 | 1671 | | |
1654 | | - | |
1655 | | - | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
1656 | 1675 | | |
1657 | 1676 | | |
1658 | 1677 | | |
1659 | 1678 | | |
1660 | 1679 | | |
1661 | 1680 | | |
1662 | 1681 | | |
1663 | | - | |
| 1682 | + | |
1664 | 1683 | | |
1665 | 1684 | | |
1666 | 1685 | | |
| |||
1686 | 1705 | | |
1687 | 1706 | | |
1688 | 1707 | | |
1689 | | - | |
| 1708 | + | |
1690 | 1709 | | |
1691 | 1710 | | |
1692 | 1711 | | |
| |||
0 commit comments