Skip to content

Commit 95ae3c1

Browse files
committed
NFSv4.2: Fix initialisation of struct nfs4_label
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Trond Myklebust <trond.myklebust@hammerspace.com> commit c528f70 The call to nfs4_label_init_security() should return a fully initialised label. Fixes: aa9c266 ("NFS: Client implementation of Labeled-NFS") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> (cherry picked from commit c528f70) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent b62d8a2 commit 95ae3c1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

fs/nfs/nfs4proc.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ nfs4_label_init_security(struct inode *dir, struct dentry *dentry,
122122
if (nfs_server_capable(dir, NFS_CAP_SECURITY_LABEL) == 0)
123123
return NULL;
124124

125+
label->lfs = 0;
126+
label->pi = 0;
127+
label->len = 0;
128+
label->label = NULL;
129+
125130
err = security_dentry_init_security(dentry, sattr->ia_mode,
126131
&dentry->d_name, NULL,
127132
(void **)&label->label, &label->len);
@@ -3795,7 +3800,7 @@ nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx,
37953800
int open_flags, struct iattr *attr, int *opened)
37963801
{
37973802
struct nfs4_state *state;
3798-
struct nfs4_label l = {0, 0, 0, NULL}, *label = NULL;
3803+
struct nfs4_label l, *label;
37993804

38003805
label = nfs4_label_init_security(dir, ctx->dentry, attr, &l);
38013806

@@ -4683,7 +4688,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
46834688
int flags)
46844689
{
46854690
struct nfs_server *server = NFS_SERVER(dir);
4686-
struct nfs4_label l, *ilabel = NULL;
4691+
struct nfs4_label l, *ilabel;
46874692
struct nfs_open_context *ctx;
46884693
struct nfs4_state *state;
46894694
int status = 0;
@@ -5034,7 +5039,7 @@ static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry,
50345039
struct nfs4_exception exception = {
50355040
.interruptible = true,
50365041
};
5037-
struct nfs4_label l, *label = NULL;
5042+
struct nfs4_label l, *label;
50385043
int err;
50395044

50405045
label = nfs4_label_init_security(dir, dentry, sattr, &l);
@@ -5075,7 +5080,7 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
50755080
struct nfs4_exception exception = {
50765081
.interruptible = true,
50775082
};
5078-
struct nfs4_label l, *label = NULL;
5083+
struct nfs4_label l, *label;
50795084
int err;
50805085

50815086
label = nfs4_label_init_security(dir, dentry, sattr, &l);
@@ -5194,7 +5199,7 @@ static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry,
51945199
struct nfs4_exception exception = {
51955200
.interruptible = true,
51965201
};
5197-
struct nfs4_label l, *label = NULL;
5202+
struct nfs4_label l, *label;
51985203
int err;
51995204

52005205
label = nfs4_label_init_security(dir, dentry, sattr, &l);

0 commit comments

Comments
 (0)