Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1698690 > unrolled thread

[PATCH] ceph: check negative offsets on ceph_llseek()

Started byLuis Henriques <lhenriques@suse.com>
First post2017-07-28 13:00 +0200
Last post2017-07-28 13:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] ceph: check negative offsets on ceph_llseek() Luis Henriques <lhenriques@suse.com> - 2017-07-28 13:00 +0200

#1698690 — [PATCH] ceph: check negative offsets on ceph_llseek()

FromLuis Henriques <lhenriques@suse.com>
Date2017-07-28 13:00 +0200
Subject[PATCH] ceph: check negative offsets on ceph_llseek()
Message-ID<u8b9U-2DD-27@gated-at.bofh.it>
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>
---
 fs/ceph/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 3d48c415f3cb..e1912e67843f 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;
 		}

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web