Skip to content

Commit 397f238

Browse files
Luis Henriquesidryomov
authored andcommitted
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 <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 06d7437 commit 397f238

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ceph/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,13 +1481,13 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
14811481
offset += file->f_pos;
14821482
break;
14831483
case SEEK_DATA:
1484-
if (offset >= i_size) {
1484+
if (offset < 0 || offset >= i_size) {
14851485
ret = -ENXIO;
14861486
goto out;
14871487
}
14881488
break;
14891489
case SEEK_HOLE:
1490-
if (offset >= i_size) {
1490+
if (offset < 0 || offset >= i_size) {
14911491
ret = -ENXIO;
14921492
goto out;
14931493
}

0 commit comments

Comments
 (0)