]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
loop: don't change loop device under exclusive opener in loop_set_status
authorRaphael Pinsonneault-Thibeault <rpthibeault@gmail.com>
Wed, 17 Dec 2025 19:00:40 +0000 (14:00 -0500)
committerJens Axboe <axboe@kernel.dk>
Tue, 6 Jan 2026 12:30:18 +0000 (05:30 -0700)
commit08e136ebd193eae7d5eff4c66d576c4a2dabdc3f
tree8c053a37df01fbdf39c0c3711dfa2e86baa03306
parent69153e8b97ebe2afc0dd101767a9805130305500
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 33ec3e53e7b1 ("loop: Don't
change loop device under exclusive opener") alongside commit ecbe6bc0003b
("block: use bd_prepare_to_claim directly in the loop driver").

Reported-by: syzbot+3ee481e21fd75e14c397@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3ee481e21fd75e14c397
Tested-by: syzbot+3ee481e21fd75e14c397@syzkaller.appspotmail.com
Tested-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Signed-off-by: Raphael Pinsonneault-Thibeault <rpthibeault@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c