]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSv4.2: Clear FATTR4_WORD2_SECURITY_LABEL when done decoding
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 18 Oct 2022 20:44:47 +0000 (16:44 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 28 Nov 2022 03:09:59 +0000 (22:09 -0500)
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>
fs/nfs/nfs4xdr.c

index acfe5f4bda480ab79edb09cc940ecf6ca613ecad..8c5298e37f0fc3633d5b459433de4daa09ac2aa5 100644 (file)
@@ -4234,6 +4234,7 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap,
                p = xdr_inline_decode(xdr, len);
                if (unlikely(!p))
                        return -EIO;
+               bitmap[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
                if (len < NFS4_MAXLABELLEN) {
                        if (label) {
                                if (label->len) {
@@ -4246,7 +4247,6 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap,
                                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);