Skip to content
Commit 985958b8 authored by Yu Kuai's avatar Yu Kuai Committed by Jens Axboe
Browse files

block: fix wrong mode for blkdev_get_by_dev() from disk_scan_partitions()



After commit 2736e8ee ("block: use the holder as indication for
exclusive opens"), blkdev_get_by_dev() will warn if holder is NULL and
mode contains 'FMODE_EXCL'.

holder from blkdev_get_by_dev() from disk_scan_partitions() is always NULL,
hence it should not use 'FMODE_EXCL', which is broben by the commit. For
consequence, WARN_ON_ONCE() will be triggered from blkdev_get_by_dev()
if user scan partitions with device opened exclusively.

Fix this problem by removing 'FMODE_EXCL' from disk_scan_partitions(),
as it used to be.

Reported-by: default avatar <syzbot+00cd27751f78817f167b@syzkaller.appspotmail.com>
Link: https://syzkaller.appspot.com/bug?extid=00cd27751f78817f167b


Fixes: 2736e8ee ("block: use the holder as indication for exclusive opens")
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230618140402.7556-1-yukuai1@huaweicloud.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e89e001f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment