NFS: Always initialise fattr->label in nfs_fattr_alloc()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 4 Nov 2021 22:03:26 +0000 (18:03 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:23:16 +0000 (10:23 +0200)
[ Upstream commit d4a95a7e5a4d3b68b26f70668cf77324a11b5718 ]

We're about to add a check in nfs_free_fattr() for whether or not the
label is non-zero.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/inode.c

index f4f75db7a82586c876a7806cae9187084f7e1be6..4ed75673adf69bee4e386915703dcf5f62312c4c 100644 (file)
@@ -1581,8 +1581,10 @@ struct nfs_fattr *nfs_alloc_fattr(void)
        struct nfs_fattr *fattr;
 
        fattr = kmalloc(sizeof(*fattr), GFP_NOFS);
-       if (fattr != NULL)
+       if (fattr != NULL) {
                nfs_fattr_init(fattr);
+               fattr->label = NULL;
+       }
        return fattr;
 }
 EXPORT_SYMBOL_GPL(nfs_alloc_fattr);