summary refs log tree commit diff
path: root/net/sunrpc/xprt.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-01-08 10:03:22 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-02-01 10:13:47 -0500
commit45bc0dce9879505d6fd9ff68dcd0359fb260dfd7 (patch)
treee5223240d66056dd158a8a67f972572f41ceb18d /net/sunrpc/xprt.c
parent6a24dfb645dbcb05b34d08b991d082bdaa3ff072 (diff)
downloadlinux-45bc0dce9879505d6fd9ff68dcd0359fb260dfd7.tar.gz
SUNRPC: Fix an RCU dereference in xprt_reserve
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r--net/sunrpc/xprt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index e1e439ea177f..7f3a01a8cae7 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1093,7 +1093,7 @@ EXPORT_SYMBOL_GPL(xprt_free);
  */
 void xprt_reserve(struct rpc_task *task)
 {
-	struct rpc_xprt	*xprt = task->tk_xprt;
+	struct rpc_xprt	*xprt;
 
 	task->tk_status = 0;
 	if (task->tk_rqstp != NULL)
@@ -1101,7 +1101,10 @@ void xprt_reserve(struct rpc_task *task)
 
 	task->tk_timeout = 0;
 	task->tk_status = -EAGAIN;
+	rcu_read_lock();
+	xprt = rcu_dereference(task->tk_client->cl_xprt);
 	xprt->ops->alloc_slot(xprt, task);
+	rcu_read_unlock();
 }
 
 static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)