Skip to content

Commit 19ec50a

Browse files
committed
Merge tag 'nfs-for-4.13-4' of git://git.linux-nfs.org/projects/anna/linux-nfs
Pull NFS client fixes from Anna Schumaker: "Two fixes from Trond this time, now that he's back from his vacation. The first is a stable fix for the EXCHANGE_ID issue on the mailing list, and the other fixes a double-free situation that he found at the same time. Stable fix: - Fix EXCHANGE_ID corrupt verifier issue Other fix: - Fix double frees in nfs4_test_session_trunk()" * tag 'nfs-for-4.13-4' of git://git.linux-nfs.org/projects/anna/linux-nfs: NFSv4: Fix double frees in nfs4_test_session_trunk() NFSv4: Fix EXCHANGE_ID corrupt verifier issue
2 parents 9f5af54 + d9cb733 commit 19ec50a

File tree

4 files changed

+9
-25
lines changed

4 files changed

+9
-25
lines changed

fs/nfs/nfs4client.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,6 @@ int nfs4_detect_session_trunking(struct nfs_client *clp,
660660
if (!nfs4_check_server_scope(clp->cl_serverscope, res->server_scope))
661661
goto out_err;
662662

663-
/* Session trunking passed, add the xprt */
664-
rpc_clnt_xprt_switch_add_xprt(clp->cl_rpcclient, xprt);
665-
666663
pr_info("NFS: %s: Session trunking succeeded for %s\n",
667664
clp->cl_hostname,
668665
xprt->address_strings[RPC_DISPLAY_ADDR]);

fs/nfs/nfs4proc.c

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7461,7 +7461,7 @@ static void nfs4_exchange_id_done(struct rpc_task *task, void *data)
74617461
cdata->res.server_scope = NULL;
74627462
}
74637463
/* Save the EXCHANGE_ID verifier session trunk tests */
7464-
memcpy(clp->cl_confirm.data, cdata->args.verifier->data,
7464+
memcpy(clp->cl_confirm.data, cdata->args.verifier.data,
74657465
sizeof(clp->cl_confirm.data));
74667466
}
74677467
out:
@@ -7474,10 +7474,6 @@ static void nfs4_exchange_id_release(void *data)
74747474
struct nfs41_exchange_id_data *cdata =
74757475
(struct nfs41_exchange_id_data *)data;
74767476

7477-
if (cdata->xprt) {
7478-
xprt_put(cdata->xprt);
7479-
rpc_clnt_xprt_switch_put(cdata->args.client->cl_rpcclient);
7480-
}
74817477
nfs_put_client(cdata->args.client);
74827478
kfree(cdata->res.impl_id);
74837479
kfree(cdata->res.server_scope);
@@ -7498,7 +7494,6 @@ static const struct rpc_call_ops nfs4_exchange_id_call_ops = {
74987494
static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
74997495
u32 sp4_how, struct rpc_xprt *xprt)
75007496
{
7501-
nfs4_verifier verifier;
75027497
struct rpc_message msg = {
75037498
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_EXCHANGE_ID],
75047499
.rpc_cred = cred,
@@ -7507,7 +7502,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
75077502
.rpc_client = clp->cl_rpcclient,
75087503
.callback_ops = &nfs4_exchange_id_call_ops,
75097504
.rpc_message = &msg,
7510-
.flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT,
7505+
.flags = RPC_TASK_TIMEOUT,
75117506
};
75127507
struct nfs41_exchange_id_data *calldata;
75137508
struct rpc_task *task;
@@ -7522,8 +7517,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
75227517
return -ENOMEM;
75237518
}
75247519

7525-
if (!xprt)
7526-
nfs4_init_boot_verifier(clp, &verifier);
7520+
nfs4_init_boot_verifier(clp, &calldata->args.verifier);
75277521

75287522
status = nfs4_init_uniform_client_string(clp);
75297523
if (status)
@@ -7562,11 +7556,9 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
75627556
if (xprt) {
75637557
calldata->xprt = xprt;
75647558
task_setup_data.rpc_xprt = xprt;
7565-
task_setup_data.flags =
7566-
RPC_TASK_SOFT|RPC_TASK_SOFTCONN|RPC_TASK_ASYNC;
7567-
calldata->args.verifier = &clp->cl_confirm;
7568-
} else {
7569-
calldata->args.verifier = &verifier;
7559+
task_setup_data.flags |= RPC_TASK_SOFTCONN;
7560+
memcpy(calldata->args.verifier.data, clp->cl_confirm.data,
7561+
sizeof(calldata->args.verifier.data));
75707562
}
75717563
calldata->args.client = clp;
75727564
#ifdef CONFIG_NFS_V4_1_MIGRATION
@@ -7585,12 +7577,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
75857577
if (IS_ERR(task))
75867578
return PTR_ERR(task);
75877579

7588-
if (!xprt) {
7589-
status = rpc_wait_for_completion_task(task);
7590-
if (!status)
7591-
status = calldata->rpc_status;
7592-
} else /* session trunking test */
7593-
status = calldata->rpc_status;
7580+
status = calldata->rpc_status;
75947581

75957582
rpc_put_task(task);
75967583
out:

fs/nfs/nfs4xdr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ static void encode_exchange_id(struct xdr_stream *xdr,
17851785
int len = 0;
17861786

17871787
encode_op_hdr(xdr, OP_EXCHANGE_ID, decode_exchange_id_maxsz, hdr);
1788-
encode_nfs4_verifier(xdr, args->verifier);
1788+
encode_nfs4_verifier(xdr, &args->verifier);
17891789

17901790
encode_string(xdr, strlen(args->client->cl_owner_id),
17911791
args->client->cl_owner_id);

include/linux/nfs_xdr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ struct nfs41_state_protection {
12351235

12361236
struct nfs41_exchange_id_args {
12371237
struct nfs_client *client;
1238-
nfs4_verifier *verifier;
1238+
nfs4_verifier verifier;
12391239
u32 flags;
12401240
struct nfs41_state_protection state_protect;
12411241
};

0 commit comments

Comments
 (0)