Skip to content

Commit a8304af

Browse files
committed
NFSv4.2: Fix a memory stomp in decode_attr_security_label
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Trond Myklebust <trond.myklebust@hammerspace.com> commit 43c1031 We must not change the value of label->len if it is zero, since that indicates we stored a label. Fixes: b4487b9 ("nfs: Fix getxattr kernel panic and memory overflow") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> (cherry picked from commit 43c1031) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 95ae3c1 commit a8304af

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

fs/nfs/nfs4xdr.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4219,12 +4219,10 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap,
42194219
if (unlikely(!p))
42204220
return -EIO;
42214221
if (len < NFS4_MAXLABELLEN) {
4222-
if (label) {
4223-
if (label->len) {
4224-
if (label->len < len)
4225-
return -ERANGE;
4226-
memcpy(label->label, p, len);
4227-
}
4222+
if (label && label->len) {
4223+
if (label->len < len)
4224+
return -ERANGE;
4225+
memcpy(label->label, p, len);
42284226
label->len = len;
42294227
label->pi = pi;
42304228
label->lfs = lfs;

0 commit comments

Comments
 (0)