Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 397f2389 authored by Luis Henriques's avatar Luis Henriques Committed by Ilya Dryomov
Browse files

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: default avatarLuis Henriques <lhenriques@suse.com>
Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 06d74376
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
		}