[PATCH 1/3] rdma: Fix memory leak in error path
Philipp Reisner
philipp.reisner at linbit.com
Wed Jul 30 16:16:51 CEST 2025
Thanks, applied
On Tue, Jul 8, 2025 at 12:20 PM zhengbing.huang <
zhengbing.huang at easystack.cn> wrote:
> In the dtr_send() function, if the __dtr_post_tx_desc() return an error,
> it means that ib_post_send() has failed.
> Then, we cannot get this tx_desc and release it through ib_poll_cq().
>
> So, we need to release this tx_desc when __dtr_post_tx_desc() fails in
> dtr_send() function.
>
> Signed-off-by: zhengbing.huang <zhengbing.huang at easystack.cn>
> ---
> drbd/drbd_transport_rdma.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drbd/drbd_transport_rdma.c b/drbd/drbd_transport_rdma.c
> index 6de0ba625..5270e503a 100644
> --- a/drbd/drbd_transport_rdma.c
> +++ b/drbd/drbd_transport_rdma.c
> @@ -581,6 +581,9 @@ static int dtr_send(struct dtr_path *path, void *buf,
> size_t size, gfp_t gfp_mas
> { .stream = ST_FLOW_CTRL, .sequence = 0 };
>
> err = __dtr_post_tx_desc(cm, tx_desc);
> + if (err)
> + dtr_free_tx_desc(cm, tx_desc);
> +
> out_put:
> kref_put(&cm->kref, dtr_destroy_cm);
> out:
> --
> 2.43.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/drbd-dev/attachments/20250730/eccd59d1/attachment.htm>
More information about the drbd-dev
mailing list