]> git.baikalelectronics.ru Git - kernel.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:06 +0000 (11:41 +0100)
[ Upstream commit eef7314caf2d73a94b68ba293cd105154d3a664e ]

We need to clear the FATTR4_WORD2_SECURITY_LABEL bitmap flag
irrespective of whether or not the label is too long.

Fixes: f28dd75f5eb4 ("NFS: Client implementation of Labeled-NFS")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/nfs4xdr.c

index 2b7741fe42eadbf63f445f84640a0e0bdac87977..ac9ffe18445146e67ee57c2e08ce297e8608942c 100644 (file)
@@ -4169,6 +4169,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) {
@@ -4181,7 +4182,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);