From: Luis Henriques Date: Fri, 28 Jul 2017 10:56:40 +0000 (+0100) Subject: ceph: check negative offsets in ceph_llseek() X-Git-Tag: v4.14-rc1~47^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=397f238994a5dae1b10e8a6efe9a2e2a95052cee;p=platform%2Fkernel%2Flinux-rpi.git ceph: check negative offsets in ceph_llseek() When a user requests SEEK_HOLE or SEEK_DATA with a negative offset ceph_llseek should return -ENXIO. Currently -EINVAL is being returned for SEEK_DATA and 0 for SEEK_HOLE. Signed-off-by: Luis Henriques Reviewed-by: Ilya Dryomov Signed-off-by: Ilya Dryomov --- diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 2eb43a5..9634eb7 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1481,13 +1481,13 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) offset += file->f_pos; break; case SEEK_DATA: - if (offset >= i_size) { + if (offset < 0 || offset >= i_size) { ret = -ENXIO; goto out; } break; case SEEK_HOLE: - if (offset >= i_size) { + if (offset < 0 || offset >= i_size) { ret = -ENXIO; goto out; }