Commit 85bfd71b authored by Chuck Lever's avatar Chuck Lever Committed by Anna Schumaker
Browse files

xprtrdma: Fix double-free in rpcrdma_ep_create()



In the error paths, there's no need to call kfree(ep) after calling
rpcrdma_ep_put(ep).

Fixes: e28ce900 ("xprtrdma: kmalloc rpcrdma_ep separate from rpcrdma_xprt")
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 11ba4688
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -406,8 +406,8 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt)

	id = rpcrdma_create_id(r_xprt, ep);
	if (IS_ERR(id)) {
		rc = PTR_ERR(id);
		goto out_free;
		kfree(ep);
		return PTR_ERR(id);
	}
	__module_get(THIS_MODULE);
	device = id->device;
@@ -506,9 +506,6 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt)
out_destroy:
	rpcrdma_ep_put(ep);
	rdma_destroy_id(id);
out_free:
	kfree(ep);
	r_xprt->rx_ep = NULL;
	return rc;
}