Skip to content

Commit

Permalink
NFSv4.1: fix SECINFO* use of put_rpccred
Browse files Browse the repository at this point in the history
Recent SP4_MACH_CRED changes allows rpc_message.rpc_cred to change,
so keep a separate pointer to the machine cred for put_rpccred.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Weston Andros Adamson authored and Trond Myklebust committed Sep 11, 2013
1 parent a027962 commit 7cb852d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6003,10 +6003,12 @@ static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct
.rpc_resp = &res,
};
struct rpc_clnt *clnt = NFS_SERVER(dir)->client;
struct rpc_cred *cred = NULL;

if (use_integrity) {
clnt = NFS_SERVER(dir)->nfs_client->cl_rpcclient;
msg.rpc_cred = nfs4_get_clid_cred(NFS_SERVER(dir)->nfs_client);
cred = nfs4_get_clid_cred(NFS_SERVER(dir)->nfs_client);
msg.rpc_cred = cred;
}

dprintk("NFS call secinfo %s\n", name->name);
Expand All @@ -6018,8 +6020,8 @@ static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct
&res.seq_res, 0);
dprintk("NFS reply secinfo: %d\n", status);

if (msg.rpc_cred)
put_rpccred(msg.rpc_cred);
if (cred)
put_rpccred(cred);

return status;
}
Expand Down Expand Up @@ -7500,20 +7502,22 @@ _nfs41_proc_secinfo_no_name(struct nfs_server *server, struct nfs_fh *fhandle,
.rpc_resp = &res,
};
struct rpc_clnt *clnt = server->client;
struct rpc_cred *cred = NULL;
int status;

if (use_integrity) {
clnt = server->nfs_client->cl_rpcclient;
msg.rpc_cred = nfs4_get_clid_cred(server->nfs_client);
cred = nfs4_get_clid_cred(server->nfs_client);
msg.rpc_cred = cred;
}

dprintk("--> %s\n", __func__);
status = nfs4_call_sync(clnt, server, &msg, &args.seq_args,
&res.seq_res, 0);
dprintk("<-- %s status=%d\n", __func__, status);

if (msg.rpc_cred)
put_rpccred(msg.rpc_cred);
if (cred)
put_rpccred(cred);

return status;
}
Expand Down

0 comments on commit 7cb852d

Please sign in to comment.