Skip to content

Commit

Permalink
xprtrdma: Fix regbuf data not freed in rpcrdma_req_create()
Browse files Browse the repository at this point in the history
[ Upstream commit 9181f40 ]

If rdma receive buffer allocate failed, should call rpcrdma_regbuf_free()
to free the send buffer, otherwise, the buffer data will be leaked.

Fixes: bb93a1a ("xprtrdma: Allocate req's regbufs at xprt create time")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zhang Xiaoxu authored and Greg Kroah-Hartman committed Jan 18, 2023
1 parent c7e9624 commit bcebcb1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/sunrpc/xprtrdma/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ struct rpcrdma_req *rpcrdma_req_create(struct rpcrdma_xprt *r_xprt, size_t size,
kfree(req->rl_sendbuf);
out3:
kfree(req->rl_rdmabuf);
rpcrdma_regbuf_free(req->rl_sendbuf);
out2:
kfree(req);
out1:
Expand Down

0 comments on commit bcebcb1

Please sign in to comment.