Repository navigation
Commit 33ec3e5
loop: Don't change loop device under exclusive opener
Loop module allows calling LOOP_SET_FD while there are other openers of
the loop device. Even exclusive ones. This can lead to weird
consequences such as kernel deadlocks like:
mount_bdev() lo_ioctl()
udf_fill_super()
udf_load_vrs()
sb_set_blocksize() - sets desired block size B
udf_tread()
sb_bread()
__bread_gfp(bdev, block, B)
loop_set_fd()
set_blocksize()
- now __getblk_slow() indefinitely loops because B != bdev
block size
Fix the problem by disallowing LOOP_SET_FD ioctl when there are
exclusive openers of a loop device.
[Deliberately chosen not to CC stable as a user with priviledges to
trigger this race has other means of taking the system down and this
has a potential of breaking some weird userspace setup]
Reported-and-tested-by: syzbot+10007d66ca02b08f0e60@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent a278682 commit 33ec3e5
1 file changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
945 | 945 | | |
946 | 946 | | |
947 | 947 | | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
948 | 959 | | |
949 | 960 | | |
950 | | - | |
| 961 | + | |
951 | 962 | | |
952 | 963 | | |
953 | 964 | | |
| |||
1012 | 1023 | | |
1013 | 1024 | | |
1014 | 1025 | | |
| 1026 | + | |
| 1027 | + | |
1015 | 1028 | | |
1016 | 1029 | | |
1017 | 1030 | | |
1018 | 1031 | | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
1019 | 1035 | | |
1020 | 1036 | | |
1021 | 1037 | | |
| |||
0 commit comments