From: Leon Romanovsky <leon@kernel.org>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: bharat@chelsio.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] RDMA/cxgb4: fix a memory leak in pass_accept_req() error path
Date: Thu, 18 Dec 2025 18:06:32 +0200 [thread overview]
Message-ID: <20251218160632.GE400630@unreal> (raw)
In-Reply-To: <20251215155607.1787217-1-vulab@iscas.ac.cn>
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
>
prev parent reply other threads:[~2025-12-18 16:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251218160632.GE400630@unreal \
--to=leon@kernel.org \
--cc=bharat@chelsio.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).