mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-29 13:00:35 +00:00
vfs: fix FIGETBSZ ioctl on an overlayfs file
Some anon_bdev filesystems (e.g. overlayfs, ceph) don't have s_blocksize
set. Returning zero from FIGETBSZ ioctl results in a Floating point
exception from the e2fsprogs utility filefrag, which divides the size of
the file with the value returned by FIGETBSZ.
Fix the interface by returning -EINVAL for these filesystems.
Fixes: d1d04ef857
("ovl: stack file ops")
Cc: <stable@vger.kernel.org> # v4.19
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
1f244dc521
commit
8f97d1e991
@ -669,6 +669,9 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
|
|||||||
return ioctl_fiemap(filp, arg);
|
return ioctl_fiemap(filp, arg);
|
||||||
|
|
||||||
case FIGETBSZ:
|
case FIGETBSZ:
|
||||||
|
/* anon_bdev filesystems may not have a block size */
|
||||||
|
if (!inode->i_sb->s_blocksize)
|
||||||
|
return -EINVAL;
|
||||||
return put_user(inode->i_sb->s_blocksize, argp);
|
return put_user(inode->i_sb->s_blocksize, argp);
|
||||||
|
|
||||||
case FICLONE:
|
case FICLONE:
|
||||||
|
Loading…
Reference in New Issue
Block a user