OSDN Git Service

vfs: fix FIGETBSZ ioctl on an overlayfs file
authorAmir Goldstein <amir73il@gmail.com>
Thu, 11 Oct 2018 14:38:14 +0000 (17:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2018 08:19:14 +0000 (09:19 +0100)
commitcbd6cfd2ee3621fd607169a130933820548851a0
tree8891b449d1c714e0a9b284726688fad1b5695bd8
parentd49d9460b0e671b8eafb7294fba5637490ed479c
vfs: fix FIGETBSZ ioctl on an overlayfs file

commit 8f97d1e99149a7f1aa19e47a51b09764382a482e upstream.

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: d1d04ef8572b ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ioctl.c