From: Andreas Gruenbacher <agruenba@redhat.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] nfs: Fix listxattr regression (2)
Date: Fri, 11 Dec 2015 17:09:23 +0100 [thread overview]
Message-ID: <1449850163-20050-1-git-send-email-agruenba@redhat.com> (raw)
In-Reply-To: <1449846859-19375-1-git-send-email-agruenba@redhat.com>
On Fri, Dec 11, 2015 at 4:14 PM, Andreas Gruenbacher <agruenba@redhat.com> wrote:
> Al,
>
> here is another fix for the same botched nfs commit. Could you please
> also merge / fold that? Sorry for the mess.
I've pushed a branch with those two fixes here:
git://git.kernel.org/pub/scm/linux/kernel/git/agruen/linux xattr-wip2
This is your work.xattr branch with the fixes folded in and with your
Signed-off-by tags removed from the two commits that have been modified:
nfs: Move call to security_inode_listsecurity into nfs_listxattr
xattr handlers: Simplify list operation
Diff between work.xattr and xattr-wip2 below.
Thanks,
Andreas
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index e9db118..c57d133 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6296,8 +6296,8 @@ nfs4_listxattr_nfs4_label(struct inode *inode, char *list, size_t list_len)
int len = 0;
if (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) {
- len = security_inode_listsecurity(inode, list, len);
- if (len > list_len)
+ len = security_inode_listsecurity(inode, list, list_len);
+ if (list_len && len > list_len)
return -ERANGE;
}
return len;
diff --git a/fs/xattr.c b/fs/xattr.c
index bfd4a85..d7f5037 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -723,21 +723,23 @@ 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)
return -ERANGE;
- memcpy(buf, handler->name, len);
- buf[len] = 0;
+ memcpy(buf, handler->name, len + 1);
buf += len + 1;
buffer_size -= len + 1;
}
prev parent reply other threads:[~2015-12-11 16:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-11 12:15 [PATCH] nfs: Fix listxattr regression Andreas Gruenbacher
2015-12-11 12:55 ` 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 [this message]
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=1449850163-20050-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
all inboxes | Powered by JetHome®