Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH] simple_xattr: permit 0-size extended attributes
@ 2014-07-16 20:14 Hugh Dickins
  0 siblings, 0 replies; only message in thread
From: Hugh Dickins @ 2014-07-16 20:14 UTC (permalink / raw)
  To: Al Viro
  Cc: Jeff Layton, Aristeu Rozanski, Andrew Morton, linux-fsdevel,
	linux-kernel

If a filesystem uses simple_xattr to support user extended attributes,
LTP setxattr01 and xfstests generic/062 fail with "Cannot allocate memory":
simple_xattr_alloc()'s wrap-around test mistakenly excludes values of zero
size.  Fix that off-by-one (but apparently no filesystem needs them yet).

Signed-off-by: Hugh Dickins <hughd@google.com>
---

 fs/xattr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 3.16-rc5/fs/xattr.c	2013-02-18 15:58:34.000000000 -0800
+++ linux/fs/xattr.c	2014-07-16 12:47:10.640004412 -0700
@@ -843,7 +843,7 @@ struct simple_xattr *simple_xattr_alloc(
 
 	/* wrap around? */
 	len = sizeof(*new_xattr) + size;
-	if (len <= sizeof(*new_xattr))
+	if (len < sizeof(*new_xattr))
 		return NULL;
 
 	new_xattr = kmalloc(len, GFP_KERNEL);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-07-16 20:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-16 20:14 [PATCH] simple_xattr: permit 0-size extended attributes Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox