Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1289507 > unrolled thread
| Started by | Andreas Gruenbacher <agruenba@redhat.com> |
|---|---|
| First post | 2015-12-11 13:20 +0100 |
| Last post | 2015-12-11 17:10 +0100 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] nfs: Fix listxattr regression Andreas Gruenbacher <agruenba@redhat.com> - 2015-12-11 13:20 +0100
Re: [PATCH] nfs: Fix listxattr regression Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-11 14:00 +0100
Re: [PATCH] nfs: Fix listxattr regression Andreas Gruenbacher <agruenba@redhat.com> - 2015-12-11 14:10 +0100
[PATCH] nfs: Fix listxattr regression (2) Andreas Gruenbacher <agruenba@redhat.com> - 2015-12-11 16:20 +0100
Re: [PATCH] nfs: Fix listxattr regression (2) Andreas Gruenbacher <agruenba@redhat.com> - 2015-12-11 17:10 +0100
| From | Andreas Gruenbacher <agruenba@redhat.com> |
|---|---|
| Date | 2015-12-11 13:20 +0100 |
| Subject | [PATCH] nfs: Fix listxattr regression |
| Message-ID | <qEuQ1-486-1@gated-at.bofh.it> |
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
--
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/
[toc] | [next] | [standalone]
| From | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| Date | 2015-12-11 14:00 +0100 |
| Message-ID | <qEvsL-4sJ-23@gated-at.bofh.it> |
| In reply to | #1289507 |
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/
[toc] | [prev] | [next] | [standalone]
| From | Andreas Gruenbacher <agruenba@redhat.com> |
|---|---|
| Date | 2015-12-11 14:10 +0100 |
| Message-ID | <qEvCq-4MO-9@gated-at.bofh.it> |
| In reply to | #1289539 |
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/
[toc] | [prev] | [next] | [standalone]
| From | Andreas Gruenbacher <agruenba@redhat.com> |
|---|---|
| Date | 2015-12-11 16:20 +0100 |
| Subject | [PATCH] nfs: Fix listxattr regression (2) |
| Message-ID | <qExEe-6dr-25@gated-at.bofh.it> |
| In reply to | #1289547 |
Al,
here is another fix for the same botched nfs commit. Could you please
also merge / fold that? Sorry for the mess.
Thanks,
Andreas
--
Fix another regression introduced in d77ae742: listxattr ended up always
failing with -ERANGE on NFSv4.2 mounts with security label support.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/nfs/nfs4proc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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;
--
2.5.0
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Andreas Gruenbacher <agruenba@redhat.com> |
|---|---|
| Date | 2015-12-11 17:10 +0100 |
| Subject | Re: [PATCH] nfs: Fix listxattr regression (2) |
| Message-ID | <qEyqC-6Ls-7@gated-at.bofh.it> |
| In reply to | #1289673 |
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;
}
--
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web