All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: Fix a race in the receive code path
@ 2017-12-03 18:50 Trond Myklebust
  2017-12-03 18:54 ` Chuck Lever
  0 siblings, 1 reply; 7+ messages in thread
From: Trond Myklebust @ 2017-12-03 18:50 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Anna Schumaker, linux-nfs

We must ensure that the call to rpc_sleep_on() in xprt_transmit() cannot
race with the call to xprt_complete_rqst().

Reported-by: Chuck Lever <chuck.lever@oracle.com>
Link: https://bugzilla.linux-nfs.org/show_bug.cgi?id=317
Fixes: ce7c252a8c74 ("SUNRPC: Add a separate spinlock to protect..")
Cc: stable@vger.kernel.org # 4.14+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 net/sunrpc/xprt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 333b9d697ae5..9d9092805696 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1035,6 +1035,7 @@ void xprt_transmit(struct rpc_task *task)
 
 	dprintk("RPC: %5u xmit complete\n", task->tk_pid);
 	task->tk_flags |= RPC_TASK_SENT;
+	spin_lock(&xprt->recv_lock);
 	spin_lock_bh(&xprt->transport_lock);
 
 	xprt->ops->set_retrans_timeout(task);
@@ -1061,6 +1062,7 @@ void xprt_transmit(struct rpc_task *task)
 		req->rq_connect_cookie = xprt->connect_cookie;
 	}
 	spin_unlock_bh(&xprt->transport_lock);
+	spin_unlock(&xprt->recv_lock);
 }
 
 static void xprt_add_backlog(struct rpc_xprt *xprt, struct rpc_task *task)
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-04  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-03 18:50 [PATCH] SUNRPC: Fix a race in the receive code path Trond Myklebust
2017-12-03 18:54 ` Chuck Lever
2017-12-03 20:12   ` Trond Myklebust
2017-12-03 20:19     ` Chuck Lever
2017-12-03 20:24       ` Trond Myklebust
2017-12-03 23:33         ` Chuck Lever
2017-12-04  0:00           ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.