lkml.org 
[lkml]   [2015]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] nfs: Fix listxattr regression
Date
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


\
 
 \ /
  Last update: 2015-12-11 13:41    [W:0.045 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site