NFSv4.2: Fix a memory stomp in decode_attr_security_label
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 18 Oct 2022 22:21:14 +0000 (18:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:18 +0000 (13:32 +0100)
commit7c6975209d98bb02a8fcd85dcbe35b9ed292aca7
tree727ce01cc9cbef8d3e165a692f4530faac119f00
parent4711196ada6bcadce9f543a40e3e848f8e31f9cf
NFSv4.2: Fix a memory stomp in decode_attr_security_label

[ Upstream commit 43c1031f7110967c240cb6e922adcfc4b8899183 ]

We must not change the value of label->len if it is zero, since that
indicates we stored a label.

Fixes: b4487b935452 ("nfs: Fix getxattr kernel panic and memory overflow")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/nfs4xdr.c