]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xprtrdma: Double free in rpcrdma_sendctxs_create()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 5 Jan 2019 13:06:48 +0000 (16:06 +0300)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 8 Jan 2019 17:06:17 +0000 (12:06 -0500)
The clean up is handled by the caller, rpcrdma_buffer_create(), so this
call to rpcrdma_sendctxs_destroy() leads to a double free.

Fixes: 690d5aee87b7 ("xprtrdma: Add data structure to manage RDMA Send arguments")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/verbs.c

index 3dde05892c8ea983f0f84a9f954d8d3ab4224a61..4994e75945b848c1dfba523e6a23cb2d45613ef5 100644 (file)
@@ -845,17 +845,13 @@ static int rpcrdma_sendctxs_create(struct rpcrdma_xprt *r_xprt)
        for (i = 0; i <= buf->rb_sc_last; i++) {
                sc = rpcrdma_sendctx_create(&r_xprt->rx_ia);
                if (!sc)
-                       goto out_destroy;
+                       return -ENOMEM;
 
                sc->sc_xprt = r_xprt;
                buf->rb_sc_ctxs[i] = sc;
        }
 
        return 0;
-
-out_destroy:
-       rpcrdma_sendctxs_destroy(buf);
-       return -ENOMEM;
 }
 
 /* The sendctx queue is not guaranteed to have a size that is a