]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nfs: Fix getxattr kernel panic and memory overflow
authorJeffrey Mitchell <jeffrey.mitchell@starlab.io>
Wed, 5 Aug 2020 17:23:19 +0000 (12:23 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 08:53:07 +0000 (10:53 +0200)
commitdb61fb8278925f54ccb0172471164aeb56ec6537
treeb9dfb5b9a5dc675c55a1d4f2bd541c13cf0ca2aa
parentfc7ce1fecea444afe8d4cb8d8bfc030e66536089
nfs: Fix getxattr kernel panic and memory overflow

[ Upstream commit b4487b93545214a9db8cbf32e86411677b0cca21 ]

Move the buffer size check to decode_attr_security_label() before memcpy()
Only call memcpy() if the buffer is large enough

Fixes: aa9c2669626c ("NFS: Client implementation of Labeled-NFS")
Signed-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>
[Trond: clean up duplicate test of label->len != 0]
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/nfs4proc.c
fs/nfs/nfs4xdr.c