mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 12:32:50 +00:00
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
This commit is contained in:
@@ -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;
|
||||
else
|
||||
|
||||
@@ -117,10 +117,7 @@ iomap_bmap_actor(struct inode *inode, loff_t pos, loff_t length,
|
||||
|
||||
if (iomap->type == IOMAP_MAPPED) {
|
||||
addr = (pos - iomap->offset + iomap->addr) >> inode->i_blkbits;
|
||||
if (addr > INT_MAX)
|
||||
WARN(1, "would truncate bmap result\n");
|
||||
else
|
||||
*bno = addr;
|
||||
*bno = addr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user