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
9 changes: 8 additions & 1 deletion drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,15 @@ static int loop_validate_file(struct file *file, struct block_device *bdev)
rmb();
f = l->lo_backing_file;
}
if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
if (S_ISBLK(inode->i_mode))
return 0;
if (!S_ISREG(inode->i_mode))
return -EINVAL;
switch (inode->i_sb->s_magic) {
case PROC_SUPER_MAGIC: /* e.g. "losetup -f /proc/sys/kernel/version" */
case SYSFS_MAGIC: /* e.g. "losetup -f /sys/power/state" */
return -EINVAL;
}
return 0;
}

Expand Down
Loading