path: root/fs/ioctl.c
diff options
authorLinus Torvalds <torvalds@linux-foundation.org>2020-05-02 11:31:12 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-05-02 11:31:12 -0700
commitf66ed1ebbfde37631fba289f7c399eaa70632abf (patch)
tree26d2658584a7ec456a55fdc3f63bcc5089220ba6 /fs/ioctl.c
parent29a47f456d6213a3173722a098a3a18865ea4db3 (diff)
parentb75dfde1212991b24b220c3995101c60a7b8ae74 (diff)
Merge tag 'iomap-5.7-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull iomap fix from Darrick Wong: "Hoist the check for an unrepresentable FIBMAP return value into ioctl_fibmap. The internal kernel function can handle 64-bit values (and is needed to fix a regression on ext4 + jbd2). It is only the userspace ioctl that is so old that it cannot deal" * tag 'iomap-5.7-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: fibmap: Warn and return an error in case of block > INT_MAX
Diffstat (limited to 'fs/ioctl.c')
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 282d45be6f45..5e80b40bc1b5 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -55,6 +55,7 @@ EXPORT_SYMBOL(vfs_ioctl);
static int ioctl_fibmap(struct file *filp, int __user *p)
struct inode *inode = file_inode(filp);
+ struct super_block *sb = inode->i_sb;
int error, ur_block;
sector_t block;
@@ -71,6 +72,13 @@ static int ioctl_fibmap(struct file *filp, int __user *p)
block = ur_block;
error = bmap(inode, &block);
+ if (block > INT_MAX) {
+ error = -ERANGE;
+ pr_warn_ratelimited("[%s/%d] FS: %s File: %pD4 would truncate fibmap result\n",
+ current->comm, task_pid_nr(current),
+ sb->s_id, filp);
+ }
if (error)
ur_block = 0;