From: Trond Myklebust <trond.myklebust@hammerspace.com>
Date: Tue, 18 Oct 2022 16:44:47 -0400
Subject: [PATCH] NFSv4.2: Clear FATTR4_WORD2_SECURITY_LABEL when done decoding
Git-commit: eef7314caf2d73a94b68ba293cd105154d3a664e
Patch-mainline: v6.2
References: git-fixes
We need to clear the FATTR4_WORD2_SECURITY_LABEL bitmap flag
irrespective of whether or not the label is too long.
Fixes: aa9c2669626c ("NFS: Client implementation of Labeled-NFS")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Acked-by: NeilBrown <neilb@suse.com>
---
fs/nfs/nfs4xdr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -4165,6 +4165,7 @@ static int decode_attr_security_label(st
p = xdr_inline_decode(xdr, len);
if (unlikely(!p))
goto out_overflow;
+ bitmap[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
if (len < NFS4_MAXLABELLEN) {
if (label) {
if (label->len) {
@@ -4177,7 +4178,6 @@ static int decode_attr_security_label(st
label->lfs = lfs;
status = NFS_ATTR_FATTR_V4_SECURITY_LABEL;
}
- bitmap[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
} else
printk(KERN_WARNING "%s: label too long (%u)!\n",
__func__, len);