From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:41273 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758070AbcDMM5W (ORCPT ); Wed, 13 Apr 2016 08:57:22 -0400 From: Andreas Gruenbacher To: Alexander Viro Cc: Andreas Gruenbacher , linux-fsdevel@vger.kernel.org, Miklos Szeredi Subject: [PATCH] xattr: Fail with -EINVAL for NULL attribute names Date: Wed, 13 Apr 2016 14:57:19 +0200 Message-Id: <1460552239-30041-1-git-send-email-agruenba@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xattr.c b/fs/xattr.c index 4861322..1515fe9 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -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; -- 2.5.5