SUNRPC: Fix a nfs4 over rdma transport oops
authorTom Talpey <tmt@netapp.com>
Wed, 27 Feb 2008 20:04:26 +0000 (15:04 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 7 Mar 2008 19:35:32 +0000 (14:35 -0500)
Prevent an RPC oops when freeing a dynamically allocated RDMA
buffer, used in certain special-case large metadata operations.

Signed-off-by: Tom Talpey <tmt@netapp.com>
Signed-off-by: James Lentini <jlentini@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/xprtrdma/transport.c

index 02c522c17de599f5ea4d776038ff1e0e5d268642..a564c1a39ec5f833b3a5dd9f369269615a047940 100644 (file)
@@ -614,7 +614,11 @@ xprt_rdma_free(void *buffer)
                return;
 
        req = container_of(buffer, struct rpcrdma_req, rl_xdr_buf[0]);
                return;
 
        req = container_of(buffer, struct rpcrdma_req, rl_xdr_buf[0]);
-       r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf);
+       if (req->rl_iov.length == 0) {  /* see allocate above */
+               r_xprt = container_of(((struct rpcrdma_req *) req->rl_buffer)->rl_buffer,
+                                     struct rpcrdma_xprt, rx_buf);
+       } else
+               r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf);
        rep = req->rl_reply;
 
        dprintk("RPC:       %s: called on 0x%p%s\n",
        rep = req->rl_reply;
 
        dprintk("RPC:       %s: called on 0x%p%s\n",