SUNRPC: fix a list corruption issue in xprt_release()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 13 Oct 2017 18:08:55 +0000 (14:08 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 16 Oct 2017 12:24:08 +0000 (08:24 -0400)
We remove the request from the receive list before we call
xprt_wait_on_pinned_rqst(), and so we need to use list_del_init().
Otherwise, we will see list corruption when xprt_complete_rqst()
is called.

Reported-by: Emre Celebi <emre@primarydata.com>
Fixes: ce7c252a8c741 ("SUNRPC: Add a separate spinlock to protect...")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
net/sunrpc/xprt.c

index e741ec2b4d8e6ea5d08a8e942e3021e5a20e4c6a..1a39ad14c42fe4aa25f174c84d7b1f9545ba6d7f 100644 (file)
@@ -1333,7 +1333,7 @@ void xprt_release(struct rpc_task *task)
                rpc_count_iostats(task, task->tk_client->cl_metrics);
        spin_lock(&xprt->recv_lock);
        if (!list_empty(&req->rq_list)) {
-               list_del(&req->rq_list);
+               list_del_init(&req->rq_list);
                xprt_wait_on_pinned_rqst(req);
        }
        spin_unlock(&xprt->recv_lock);