SUNRPC: Fix a bug in call_decode()
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 19 Apr 2008 17:15:47 +0000 (13:15 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 19 Apr 2008 20:52:33 +0000 (16:52 -0400)
call_verify() can, under certain circumstances, free the RPC slot. In that
case, our cached pointer 'req = task->tk_rqstp' is invalid. Bug was
introduced in commit 220bcc2afd7011b3e0569fc178331fa983c92c1b (SUNRPC:
Don't call xprt_release in call refresh).

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/clnt.c

index ea14314331b08b2ee2556e9d5be05c520a375b35..522b06849f86cfe9f789c2c40bb4e2f667f2692d 100644 (file)
@@ -1240,10 +1240,13 @@ call_decode(struct rpc_task *task)
                        task->tk_status);
        return;
 out_retry:
-       req->rq_received = req->rq_private_buf.len = 0;
        task->tk_status = 0;
-       if (task->tk_client->cl_discrtry)
-               xprt_force_disconnect(task->tk_xprt);
+       /* Note: call_verify() may have freed the RPC slot */
+       if (task->tk_rqstp == req) {
+               req->rq_received = req->rq_private_buf.len = 0;
+               if (task->tk_client->cl_discrtry)
+                       xprt_force_disconnect(task->tk_xprt);
+       }
 }
 
 /*