Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions block/bdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,18 @@ int lookup_bdev(const char *pathname, dev_t *dev)
if (!may_open_dev(&path))
goto out_path_put;

/*
* Reject a block device inode with i_rdev == 0. A dev_t of 0 is
* never valid for a block device: no real block device driver
* registers major 0. Fake block device inodes (e.g. fuse with
* rootmode=S_IFBLK) can expose i_rdev == 0, and letting that
* propagate would confuse superblock lookup and trigger warnings
* in the device-to-superblock table (super_dev_register).
*/
error = -ENODEV;
if (!inode->i_rdev)
goto out_path_put;

*dev = inode->i_rdev;
error = 0;
out_path_put:
Expand Down
Loading