* [PATCH] RDMA/cxgb4: fix a memory leak in pass_accept_req() error path
@ 2025-12-15 15:56 Wentao Liang
2025-12-18 16:06 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2025-12-15 15:56 UTC (permalink / raw)
To: bharat, jgg, leon; +Cc: linux-rdma, linux-kernel, Wentao Liang, stable
In the alloc_ep_skb_list() failure path, the c4iw_put_ep() is
incorrectly used instead of the kfree(). Since the child_ep's
reference count hasn't been properly established at this point,
the c4iw_put_ep() won't actually free the memory, resulting in
permanent memory leak.
Fix by releasing child_ep correctly in the fail path.
Fixes: 4a740838bf44 ("RDMA/iw_cxgb4: Low resource fixes for connection manager")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/infiniband/hw/cxgb4/cm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index b3b45c49077d..a09eeb48775f 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -2665,7 +2665,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
}
goto out;
fail:
- c4iw_put_ep(&child_ep->com);
+ kfree(child_ep);
reject:
reject_cr(dev, hwtid, skb);
out:
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/cxgb4: fix a memory leak in pass_accept_req() error path
2025-12-15 15:56 [PATCH] RDMA/cxgb4: fix a memory leak in pass_accept_req() error path Wentao Liang
@ 2025-12-18 16:06 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2025-12-18 16:06 UTC (permalink / raw)
To: Wentao Liang; +Cc: bharat, jgg, linux-rdma, linux-kernel, stable
On Mon, Dec 15, 2025 at 03:56:07PM +0000, Wentao Liang wrote:
> In the alloc_ep_skb_list() failure path, the c4iw_put_ep() is
> incorrectly used instead of the kfree(). Since the child_ep's
> reference count hasn't been properly established at this point,
> the c4iw_put_ep() won't actually free the memory, resulting in
> permanent memory leak.
>
> Fix by releasing child_ep correctly in the fail path.
>
> Fixes: 4a740838bf44 ("RDMA/iw_cxgb4: Low resource fixes for connection manager")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/infiniband/hw/cxgb4/cm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
> index b3b45c49077d..a09eeb48775f 100644
> --- a/drivers/infiniband/hw/cxgb4/cm.c
> +++ b/drivers/infiniband/hw/cxgb4/cm.c
> @@ -2665,7 +2665,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
> }
> goto out;
> fail:
> - c4iw_put_ep(&child_ep->com);
> + kfree(child_ep);
You should squash with your previous patch and get Acked-by from cxgb4
maintainers.
Thanks
> reject:
> reject_cr(dev, hwtid, skb);
> out:
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-18 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15 15:56 [PATCH] RDMA/cxgb4: fix a memory leak in pass_accept_req() error path Wentao Liang
2025-12-18 16:06 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).