Skip to contentSkip to conversation

simple_xattr: permit 0-size extended attributes

PATCH New Hugh Dickins 1 participant 1 message Jul 16, 2014 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 simple_xattr: permit 0-size extended attributes

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).

---

 fs/xattr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xattr.c +1 -1
@@ -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);