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

Changed files
+9 -4
fs
+8
fs/ioctl.c
··· 55 55 static int ioctl_fibmap(struct file *filp, int __user *p) 56 56 { 57 57 struct inode *inode = file_inode(filp); 58 + struct super_block *sb = inode->i_sb; 58 59 int error, ur_block; 59 60 sector_t block; 60 61 ··· 71 70 72 71 block = ur_block; 73 72 error = bmap(inode, &block); 73 + 74 + if (block > INT_MAX) { 75 + error = -ERANGE; 76 + pr_warn_ratelimited("[%s/%d] FS: %s File: %pD4 would truncate fibmap result\n", 77 + current->comm, task_pid_nr(current), 78 + sb->s_id, filp); 79 + } 74 80 75 81 if (error) 76 82 ur_block = 0;
+1 -4
fs/iomap/fiemap.c
··· 117 117 118 118 if (iomap->type == IOMAP_MAPPED) { 119 119 addr = (pos - iomap->offset + iomap->addr) >> inode->i_blkbits; 120 - if (addr > INT_MAX) 121 - WARN(1, "would truncate bmap result\n"); 122 - else 123 - *bno = addr; 120 + *bno = addr; 124 121 } 125 122 return 0; 126 123 }