Merge tag 'nfs-for-4.13-4' of git://git.linux-nfs.org/projects/anna/linux-nfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Aug 2017 03:56:44 +0000 (20:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Aug 2017 03:56:44 +0000 (20:56 -0700)
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

fs/nfs/nfs4client.c
fs/nfs/nfs4proc.c
fs/nfs/nfs4xdr.c
include/linux/nfs_xdr.h

index 50566acb54694ac4f14330f4bbb7ab360ba15f88..e9bea90dc0179770b9fbfa39fe6651c5949f0d62 100644 (file)
@@ -660,9 +660,6 @@ int nfs4_detect_session_trunking(struct nfs_client *clp,
        if (!nfs4_check_server_scope(clp->cl_serverscope, res->server_scope))
                goto out_err;
 
-       /* Session trunking passed, add the xprt */
-       rpc_clnt_xprt_switch_add_xprt(clp->cl_rpcclient, xprt);
-
        pr_info("NFS:  %s: Session trunking succeeded for %s\n",
                clp->cl_hostname,
                xprt->address_strings[RPC_DISPLAY_ADDR]);
index 18ca6879d8de9ecebf22d0f4f9ba73b66fdeeddc..ffd2e712595d8ac875dc2780b52731543c687ca8 100644 (file)
@@ -7461,7 +7461,7 @@ static void nfs4_exchange_id_done(struct rpc_task *task, void *data)
                        cdata->res.server_scope = NULL;
                }
                /* Save the EXCHANGE_ID verifier session trunk tests */
-               memcpy(clp->cl_confirm.data, cdata->args.verifier->data,
+               memcpy(clp->cl_confirm.data, cdata->args.verifier.data,
                       sizeof(clp->cl_confirm.data));
        }
 out:
@@ -7474,10 +7474,6 @@ static void nfs4_exchange_id_release(void *data)
        struct nfs41_exchange_id_data *cdata =
                                        (struct nfs41_exchange_id_data *)data;
 
-       if (cdata->xprt) {
-               xprt_put(cdata->xprt);
-               rpc_clnt_xprt_switch_put(cdata->args.client->cl_rpcclient);
-       }
        nfs_put_client(cdata->args.client);
        kfree(cdata->res.impl_id);
        kfree(cdata->res.server_scope);
@@ -7498,7 +7494,6 @@ static const struct rpc_call_ops nfs4_exchange_id_call_ops = {
 static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
                        u32 sp4_how, struct rpc_xprt *xprt)
 {
-       nfs4_verifier verifier;
        struct rpc_message msg = {
                .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_EXCHANGE_ID],
                .rpc_cred = cred,
@@ -7507,7 +7502,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
                .rpc_client = clp->cl_rpcclient,
                .callback_ops = &nfs4_exchange_id_call_ops,
                .rpc_message = &msg,
-               .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT,
+               .flags = RPC_TASK_TIMEOUT,
        };
        struct nfs41_exchange_id_data *calldata;
        struct rpc_task *task;
@@ -7522,8 +7517,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
                return -ENOMEM;
        }
 
-       if (!xprt)
-               nfs4_init_boot_verifier(clp, &verifier);
+       nfs4_init_boot_verifier(clp, &calldata->args.verifier);
 
        status = nfs4_init_uniform_client_string(clp);
        if (status)
@@ -7562,11 +7556,9 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
        if (xprt) {
                calldata->xprt = xprt;
                task_setup_data.rpc_xprt = xprt;
-               task_setup_data.flags =
-                               RPC_TASK_SOFT|RPC_TASK_SOFTCONN|RPC_TASK_ASYNC;
-               calldata->args.verifier = &clp->cl_confirm;
-       } else {
-               calldata->args.verifier = &verifier;
+               task_setup_data.flags |= RPC_TASK_SOFTCONN;
+               memcpy(calldata->args.verifier.data, clp->cl_confirm.data,
+                               sizeof(calldata->args.verifier.data));
        }
        calldata->args.client = clp;
 #ifdef CONFIG_NFS_V4_1_MIGRATION
@@ -7585,12 +7577,7 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred,
        if (IS_ERR(task))
                return PTR_ERR(task);
 
-       if (!xprt) {
-               status = rpc_wait_for_completion_task(task);
-               if (!status)
-                       status = calldata->rpc_status;
-       } else  /* session trunking test */
-               status = calldata->rpc_status;
+       status = calldata->rpc_status;
 
        rpc_put_task(task);
 out:
index fa3eb361d4f863be18072272293dcbdcedfd887f..37c8af00327588d772610cac487fcf0651cf8fbf 100644 (file)
@@ -1785,7 +1785,7 @@ static void encode_exchange_id(struct xdr_stream *xdr,
        int len = 0;
 
        encode_op_hdr(xdr, OP_EXCHANGE_ID, decode_exchange_id_maxsz, hdr);
-       encode_nfs4_verifier(xdr, args->verifier);
+       encode_nfs4_verifier(xdr, &args->verifier);
 
        encode_string(xdr, strlen(args->client->cl_owner_id),
                        args->client->cl_owner_id);
index ca3bcc4ed4e55563ecd505fada0cc0dc1f5dbb8d..62cbcb842f99c2cbda7121bcb5a4ebc5e818a3bc 100644 (file)
@@ -1235,7 +1235,7 @@ struct nfs41_state_protection {
 
 struct nfs41_exchange_id_args {
        struct nfs_client               *client;
-       nfs4_verifier                   *verifier;
+       nfs4_verifier                   verifier;
        u32                             flags;
        struct nfs41_state_protection   state_protect;
 };