summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2012-12-08 15:30:18 +0100
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-12-11 15:14:50 +0100
commit7d3e91a89b7adbc2831334def9e494dd9892f9af (patch)
tree7069dabbdabe013f21b56ea1641875ef4d5bb283 /fs
parentnfs: Fix wrong slab cache in nfs_commit_mempool (diff)
downloadlinux-7d3e91a89b7adbc2831334def9e494dd9892f9af.tar.xz
linux-7d3e91a89b7adbc2831334def9e494dd9892f9af.zip
NFSv4: Check for buffer length in __nfs4_get_acl_uncached
Commit 1f1ea6c "NFSv4: Fix buffer overflow checking in __nfs4_get_acl_uncached" accidently dropped the checking for too small result buffer length. If someone uses getxattr on "system.nfs4_acl" on an NFSv4 mount supporting ACLs, the ACL has not been cached and the buffer suplied is too short, we still copy the complete ACL, resulting in kernel and user space memory corruption. Signed-off-by: Sven Wegener <sven.wegener@stealer.net> Cc: stable@kernel.org Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5eec4429970c..05e5f6f9f2b8 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3937,8 +3937,13 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
goto out_free;
}
nfs4_write_cached_acl(inode, pages, res.acl_data_offset, res.acl_len);
- if (buf)
+ if (buf) {
+ if (res.acl_len > buflen) {
+ ret = -ERANGE;
+ goto out_free;
+ }
_copy_from_pages(buf, pages, res.acl_data_offset, res.acl_len);
+ }
out_ok:
ret = res.acl_len;
out_free: