Эх сурвалжийг харах

xattr: Fail with -EINVAL for NULL attribute names

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>
Andreas Gruenbacher 9 жил өмнө
parent
commit
aaf431b4f9
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  1. 1 1
      fs/xattr.c

+ 1 - 1
fs/xattr.c

@@ -668,7 +668,7 @@ xattr_resolve_name(const struct xattr_handler **handlers, const char **name)
 	const struct xattr_handler *handler;
 	const struct xattr_handler *handler;
 
 
 	if (!*name)
 	if (!*name)
-		return NULL;
+		return ERR_PTR(-EINVAL);
 
 
 	for_each_xattr_handler(handlers, handler) {
 	for_each_xattr_handler(handlers, handler) {
 		const char *n;
 		const char *n;