From: Trond Myklebust <trond.myklebust@hammerspace.com>
Date: Thu, 4 Nov 2021 18:03:26 -0400
Subject: [PATCH] NFS: Always initialise fattr->label in nfs_fattr_alloc()
Git-commit: d4a95a7e5a4d3b68b26f70668cf77324a11b5718
Patch-mainline: v5.16
References: git-fixes
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>
Acked-by: NeilBrown <neilb@suse.com>
---
fs/nfs/inode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1584,8 +1584,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);