From: Jeff Layton <jlayton@kernel.org>
To: linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, zyan@redhat.com, sage@redhat.com,
agruenba@redhat.com, joe@perches.com, pmladek@suse.com,
rostedt@goodmis.org, geert+renesas@glider.be,
andriy.shevchenko@linux.intel.com
Subject: [PATCH v2 3/3] ceph: return -ERANGE if virtual xattr value didn't fit in buffer
Date: Wed, 19 Jun 2019 12:45:28 -0400 [thread overview]
Message-ID: <20190619164528.31958-4-jlayton@kernel.org> (raw)
In-Reply-To: <20190619164528.31958-1-jlayton@kernel.org>
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@kernel.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
next prev parent reply other threads:[~2019-06-19 16:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-19 16:45 [PATCH v2 0/3] ceph: don't NULL terminate virtual xattr values Jeff Layton
2019-06-19 16:45 ` [PATCH v2 1/3] lib/vsprintf: add snprintf_noterm Jeff Layton
2019-06-19 16:45 ` [PATCH v2 2/3] ceph: don't NULL terminate virtual xattr strings Jeff Layton
2019-06-19 16:45 ` Jeff Layton [this message]
2019-06-20 10:24 ` [PATCH v2 0/3] ceph: don't NULL terminate virtual xattr values Andy Shevchenko
2019-06-20 11:41 ` Jeff Layton
2019-06-20 12:22 ` Geert Uytterhoeven
2019-06-20 13:54 ` Jeff Layton
2019-06-25 22:50 ` Steven Rostedt
2019-06-20 12:34 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190619164528.31958-4-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=agruenba@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=ceph-devel@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=idryomov@gmail.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sage@redhat.com \
--cc=zyan@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox