[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190619164528.31958-4-jlayton@kernel.org>
Date: Wed, 19 Jun 2019 12:45:28 -0400
From: Jeff Layton <jlayton@...nel.org>
To: linux-kernel@...r.kernel.org, ceph-devel@...r.kernel.org
Cc: idryomov@...il.com, zyan@...hat.com, sage@...hat.com,
agruenba@...hat.com, joe@...ches.com, pmladek@...e.com,
rostedt@...dmis.org, geert+renesas@...der.be,
andriy.shevchenko@...ux.intel.com
Subject: [PATCH v2 3/3] ceph: return -ERANGE if virtual xattr value didn't fit in buffer
The getxattr manpage states that we should return ERANGE if the
destination buffer size is too small to hold the value.
Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
fs/ceph/xattr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index a1cd9613be98..e3246c27f2da 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -805,8 +805,11 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value,
if (err)
return err;
err = -ENODATA;
- if (!(vxattr->exists_cb && !vxattr->exists_cb(ci)))
+ if (!(vxattr->exists_cb && !vxattr->exists_cb(ci))) {
err = vxattr->getxattr_cb(ci, value, size);
+ if (size && size < err)
+ err = -ERANGE;
+ }
return err;
}
--
2.21.0
Powered by blists - more mailing lists