linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Subject: [PATCH] nfs: Fix listxattr regression
Date: Fri, 11 Dec 2015 13:15:46 +0100	[thread overview]
Message-ID: <1449836146-5674-1-git-send-email-agruenba@redhat.com> (raw)

Al,

the xattr cleanup patches which are meanwhile in your for-next branch broke
listxattr on nfs.  Could you please add this fix?

Thanks,
Andreas

--

In removing the list operation of nfs4_xattr_nfs4_label_handler, commit
d77ae742 has introduced a NULL pointer dereference in generic_listxattr.
Fix by checking for NULL list operations.  In addition, skip prefix (as
opposed to full-name) xattr handlers there: listing a prefix is not
meaningful.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/xattr.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index bfd4a85..477bda2 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -723,15 +723,18 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
 
 	if (!buffer) {
 		for_each_xattr_handler(handlers, handler) {
-			if (handler->list(dentry))
-				size += strlen(handler->name) + 1;
+			if (!handler->name ||
+			    (handler->list && !handler->list(dentry)))
+				continue;
+			size += strlen(handler->name) + 1;
 		}
 	} else {
 		char *buf = buffer;
 		size_t len;
 
 		for_each_xattr_handler(handlers, handler) {
-			if (!handler->list(dentry))
+			if (!handler->name ||
+			    (handler->list && !handler->list(dentry)))
 				continue;
 			len = strlen(handler->name);
 			if (len + 1 > buffer_size)
-- 
2.5.0


             reply	other threads:[~2015-12-11 12:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 12:15 Andreas Gruenbacher [this message]
2015-12-11 12:55 ` [PATCH] nfs: Fix listxattr regression Al Viro
2015-12-11 13:09   ` Andreas Gruenbacher
2015-12-11 15:14     ` [PATCH] nfs: Fix listxattr regression (2) Andreas Gruenbacher
2015-12-11 16:09       ` Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449836146-5674-1-git-send-email-agruenba@redhat.com \
    --to=agruenba@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).