xattr: Fail with -EINVAL for NULL attribute names
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 9 May 2016 11:28:49 +0000 (13:28 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 25 May 2016 21:33:47 +0000 (17:33 -0400)
Commit 98e9cb57 improved the xattr name checks in xattr_resolve_name but
didn't update the NULL attribute name check appropriately, so NULL
attribute names lead to NULL pointer dereferences.  Turn that into
-EINVAL results instead.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
  fs/xattr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/xattr.c

index b11945e15fde2b62d59c5c81c5aead48fb0e5d83..4231488f2122e9dc33f4059071a13ebca152ea99 100644 (file)
@@ -668,7 +668,7 @@ xattr_resolve_name(const struct xattr_handler **handlers, const char **name)
        const struct xattr_handler *handler;
 
        if (!*name)
-               return NULL;
+               return ERR_PTR(-EINVAL);
 
        for_each_xattr_handler(handlers, handler) {
                const char *n;