diff options
author | Luis Henriques <lhenriques@suse.com> | 2017-07-28 06:56:40 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-09-06 13:56:50 -0400 |
commit | 397f238994a5dae1b10e8a6efe9a2e2a95052cee (patch) | |
tree | 7df8cdbc580dd035874af23647653836da0da0d6 /fs/ceph/file.c | |
parent | 06d74376c8af32f5b8d777a943aa4dc99165088b (diff) |
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 <lhenriques@suse.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r-- | fs/ceph/file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 2eb43a54e2d6..9634eb79b041 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) | |||
1481 | offset += file->f_pos; | 1481 | offset += file->f_pos; |
1482 | break; | 1482 | break; |
1483 | case SEEK_DATA: | 1483 | case SEEK_DATA: |
1484 | if (offset >= i_size) { | 1484 | if (offset < 0 || offset >= i_size) { |
1485 | ret = -ENXIO; | 1485 | ret = -ENXIO; |
1486 | goto out; | 1486 | goto out; |
1487 | } | 1487 | } |
1488 | break; | 1488 | break; |
1489 | case SEEK_HOLE: | 1489 | case SEEK_HOLE: |
1490 | if (offset >= i_size) { | 1490 | if (offset < 0 || offset >= i_size) { |
1491 | ret = -ENXIO; | 1491 | ret = -ENXIO; |
1492 | goto out; | 1492 | goto out; |
1493 | } | 1493 | } |