summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Gelato <Sergio.Gelato@astro.su.se>2014-09-24 08:47:24 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-12-06 15:05:50 -0800
commit617e78c952e4c7d6720b9d01650d3a973f6e80df (patch)
treee43edc8b1665944acfda35a52eea72e0a99d12b6
parentde8a7ea2e766700fd2bd692647ca4a2b07d24e99 (diff)
downloadlwn-617e78c952e4c7d6720b9d01650d3a973f6e80df.tar.gz
lwn-617e78c952e4c7d6720b9d01650d3a973f6e80df.zip
nfsd: Fix ACL null pointer deref
BugLink: http://bugs.launchpad.net/bugs/1348670 Fix regression introduced in pre-3.14 kernels by cherry-picking aa07c713ecfc0522916f3cd57ac628ea6127c0ec (NFSD: Call ->set_acl with a NULL ACL structure if no entries). The affected code was removed in 3.14 by commit 4ac7249ea5a0ceef9f8269f63f33cc873c3fac61 (nfsd: use get_acl and ->set_acl). The ->set_acl methods are already able to cope with a NULL argument. Signed-off-by: Sergio Gelato <Sergio.Gelato@astro.su.se> [bwh: Rewrite the subject] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Cc: Moritz Mühlenhoff <muehlenhoff@univention.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/nfsd/vfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index d9b298cbfe5c..81325ba8660a 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -508,6 +508,9 @@ set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key)
char *buf = NULL;
int error = 0;
+ if (!pacl)
+ return vfs_setxattr(dentry, key, NULL, 0, 0);
+
buflen = posix_acl_xattr_size(pacl->a_count);
buf = kmalloc(buflen, GFP_KERNEL);
error = -ENOMEM;