diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2024-05-02 23:36:32 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2024-05-02 23:39:44 +0200 |
commit | d18a8679581e8d1166b68e211d16c5349ae8c38c (patch) | |
tree | efdb0b8ed78c16bb97ce8ed3ae0576bec29278f7 /block/bdev.c | |
parent | set_blocksize(): switch to passing struct file * (diff) | |
download | linux-d18a8679581e8d1166b68e211d16c5349ae8c38c.tar.xz linux-d18a8679581e8d1166b68e211d16c5349ae8c38c.zip |
make set_blocksize() fail unless block device is opened exclusive
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
-rw-r--r-- | block/bdev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/block/bdev.c b/block/bdev.c index a329ff9be11d..a89bce368b64 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -157,6 +157,9 @@ int set_blocksize(struct file *file, int size) if (size < bdev_logical_block_size(bdev)) return -EINVAL; + if (!file->private_data) + return -EINVAL; + /* Don't change the size if it is same as current */ if (inode->i_blkbits != blksize_bits(size)) { sync_blockdev(bdev); |