From: Jason Gunthorpe <jgg@nvidia.com>
To: Chenguang Zhao <zhaochenguang@kylinos.cn>
Cc: "Leon Romanovsky" <leon@kernel.org>,
"Vlad Dumitrescu" <vdumitrescu@nvidia.com>,
"Sean Hefty" <shefty@nvidia.com>,
"Håkon Bugge" <haakon.bugge@oracle.com>,
"Kees Cook" <kees@kernel.org>,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/cm: fix timewait leak and AV cleanup on ib_send_cm_req() errors
Date: Tue, 2 Jun 2026 16:30:49 -0300 [thread overview]
Message-ID: <20260602193049.GA1073194@nvidia.com> (raw)
In-Reply-To: <20260507094317.1018853-1-zhaochenguang@kylinos.cn>
On Thu, May 07, 2026 at 05:43:17PM +0800, Chenguang Zhao wrote:
> cm_create_timewait_info() success was followed by error returns that
> never freed cm_id_priv->timewait_info, leaking it and tripping the
> WARN_ON(timewait_info) on a later ib_send_cm_req().
Yes, Leon is right, the ucma doesn't allow a ib_send_cm_req to be
called twice and it would be an error for any in-kernel caller to send
the same thing.
> -out_free:
> +err_free_msg:
> cm_free_priv_msg(msg);
> -out_unlock:
> +err_destroy_id_av:
> + if (param->alternate_path)
> + cm_destroy_av(&cm_id_priv->alt_av);
> + cm_destroy_av(&cm_id_priv->av);
And this doesn't properly understand the lifetime model of the av, it
should not be freed here.
I did find a real leak on error path while looking at this though :\
Jason
prev parent reply other threads:[~2026-06-02 19:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-07 9:43 [PATCH] RDMA/cm: fix timewait leak and AV cleanup on ib_send_cm_req() errors Chenguang Zhao
2026-05-13 14:22 ` Leon Romanovsky
2026-06-02 19:30 ` Jason Gunthorpe [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=20260602193049.GA1073194@nvidia.com \
--to=jgg@nvidia.com \
--cc=haakon.bugge@oracle.com \
--cc=kees@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=shefty@nvidia.com \
--cc=vdumitrescu@nvidia.com \
--cc=zhaochenguang@kylinos.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.