nfs: Fix listxattr regression
diff mbox series

Message ID 1449836146-5674-1-git-send-email-agruenba@redhat.com
State New, archived
Headers show
Series
  • nfs: Fix listxattr regression
Related show

Commit Message

Andreas Gruenbacher Dec. 11, 2015, 12:15 p.m. UTC
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(-)

Comments

Al Viro Dec. 11, 2015, 12:55 p.m. UTC | #1
On Fri, Dec 11, 2015 at 01:15:46PM +0100, Andreas Gruenbacher wrote:
> Al,
> 
> the xattr cleanup patches which are meanwhile in your for-next branch broke
> listxattr on nfs.  Could you please add this fix?

Umm...  Would you be OK with folding that into commit in question?  I'd
rather not introduce a bisect hazard in the first place...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Andreas Gruenbacher Dec. 11, 2015, 1:09 p.m. UTC | #2
On Fri, Dec 11, 2015 at 1:55 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Fri, Dec 11, 2015 at 01:15:46PM +0100, Andreas Gruenbacher wrote:
>> Al,
>>
>> the xattr cleanup patches which are meanwhile in your for-next branch broke
>> listxattr on nfs.  Could you please add this fix?
>
> Umm...  Would you be OK with folding that into commit in question?  I'd
> rather not introduce a bisect hazard in the first place...

Yes sure, if you are okay with rebasing.

I assume that there is no point in reposting the xattr cleanups with
this fix included; if you would prefer a repost, let me know.

Thanks,
Andreas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch
diff mbox series

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)