Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] SVC: Guard call to xpo_release_rqst in svc_send
@ 2008-02-27 19:58 Tom Tucker
       [not found] ` <1204142339.24762.94.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tucker @ 2008-02-27 19:58 UTC (permalink / raw)
  To: bfields; +Cc: linux-nfs, jaschut, swise

    
The svc_send path is calling xpo_release_rqst without checking
the XPT_DEAD bit. It is illegal to call transport methods on a dead
transport. In practice, if the transport gets an error and shuts down
while there are still RPC in svc_process the resulting svc_send could
crash calling into a transport that is being shut down.
    
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
---
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index ea377e0..467c1c0 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -729,9 +729,6 @@ int svc_send(struct svc_rqst *rqstp)
 	if (!xprt)
 		return -EFAULT;
 
-	/* release the receive skb before sending the reply */
-	rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
-
 	/* calculate over-all length */
 	xb = &rqstp->rq_res;
 	xb->len = xb->head[0].iov_len +
@@ -742,8 +739,11 @@ int svc_send(struct svc_rqst *rqstp)
 	mutex_lock(&xprt->xpt_mutex);
 	if (test_bit(XPT_DEAD, &xprt->xpt_flags))
 		len = -ENOTCONN;
-	else
+	else {
+		/* release the receive skb before sending the reply */
+		rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
 		len = xprt->xpt_ops->xpo_sendto(rqstp);
+	}
 	mutex_unlock(&xprt->xpt_mutex);
 	svc_xprt_release(rqstp);
 


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

end of thread, other threads:[~2008-03-01 18:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-27 19:58 [PATCH] SVC: Guard call to xpo_release_rqst in svc_send Tom Tucker
     [not found] ` <1204142339.24762.94.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2008-02-29 20:40   ` J. Bruce Fields
2008-03-01  3:20     ` Tom Tucker
2008-03-01 16:24       ` J. Bruce Fields
2008-03-01 18:53         ` Tom Tucker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox