* [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp
@ 2025-09-24 6:14 YanLong Dai
2025-10-19 10:48 ` Leon Romanovsky
0 siblings, 1 reply; 7+ messages in thread
From: YanLong Dai @ 2025-09-24 6:14 UTC (permalink / raw)
To: kalesh-anakkur.purayil
Cc: jgg, leon, linux-kernel, linux-rdma, selvin.xavier, daiyanlong,
dyl_wlc
The current error handling path in bnxt_re_destroy_gsi_sqp() could lead
to a resource leak. When bnxt_qplib_destroy_qp() fails, the function
jumps to the 'fail' label and returns immediately, skipping the call
to bnxt_qplib_free_qp_res().
Continue the resource teardown even if bnxt_qplib_destroy_qp() fails,
which aligns with the driver's general error handling strategy and
prevents the potential leak.
Fixes: 8dae419f9ec73 ("RDMA/bnxt_re: Refactor queue pair creation code")
Signed-off-by: YanLong Dai <daiyanlong@kylinos.cn>
---
v2:
- Updated subject prefix to 'rdma-rc'
---
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 260dc67b8b87..15d3f5d5c0ee 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -931,10 +931,9 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp)
ibdev_dbg(&rdev->ibdev, "Destroy the shadow QP\n");
rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &gsi_sqp->qplib_qp);
- if (rc) {
+ if (rc)
ibdev_err(&rdev->ibdev, "Destroy Shadow QP failed");
- goto fail;
- }
+
bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp);
/* remove from active qp list */
@@ -951,8 +950,6 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp)
rdev->gsi_ctx.sqp_tbl = NULL;
return 0;
-fail:
- return rc;
}
/* Queue Pairs */
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp
@ 2025-09-24 6:33 代彦龙
0 siblings, 0 replies; 7+ messages in thread
From: 代彦龙 @ 2025-09-24 6:33 UTC (permalink / raw)
To: Kalesh Anakkur Purayil
Cc: jgg, leon, linux-kernel, linux-rdma, selvin.xavier, dyl_wlc
[-- Attachment #1: Type: text/html, Size: 5773 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* 回复: Re: [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp
@ 2025-09-26 2:39 代彦龙
2025-09-26 16:11 ` åå¤: " yanjun.zhu
0 siblings, 1 reply; 7+ messages in thread
From: 代彦龙 @ 2025-09-26 2:39 UTC (permalink / raw)
To: Kalesh Anakkur Purayil
Cc: jgg, leon, linux-kernel, linux-rdma, selvin.xavier, dyl_wlc
[-- Attachment #1: Type: text/html, Size: 7654 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: åå¤: Re: [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp
2025-09-26 2:39 回复: Re: [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp 代彦龙
@ 2025-09-26 16:11 ` yanjun.zhu
2025-09-28 1:11 ` YanLong Dai
0 siblings, 1 reply; 7+ messages in thread
From: yanjun.zhu @ 2025-09-26 16:11 UTC (permalink / raw)
To: 代彦龙, Kalesh Anakkur Purayil
Cc: jgg, leon, linux-kernel, linux-rdma, selvin.xavier, dyl_wlc
On 9/25/25 7:39 PM, ä»£å½¦é¾ wrote:
> Hello Kalesh, Selvin, List,
>
> Gentle ping on this patch.
> I just wanted to follow up and make sure the v2 version was received
> correctly.
>
> For easy reference, the patch is available on lore.kernel.org here:
> https://lore.kernel.org/all/20250924061444.11288-1-daiyanlong <https://
> lore.kernel.org/all/20250924061444.11288-1-daiyanlong>@kylinos.cn/
>
> Please let me know if there's anything else needed from my side, or if
> you've had a chance to review the technical changes.
> Thank you for your time and consideration.
>
> Best regards,
> YanLong Dai
>
Hi, YanLong
In regions where Chinese is not supported, the email may appear garbled.
We recommend replacing any Chinese content in the email with the
corresponding English to ensure clarity.
Thanks a lot.
Yanjun.Zhu
>
>
>
> *主 题:*Re: [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory
> leak in destroy_gsi_sqp
> *日 期:*2025年09月24日14:33
> *发件人:*代彦龙
> *收件人:*Kalesh Anakkur Purayil,代彦龙
> *抄送人:*jgg,leon,linux-kernel,linux-rdma,selvin.xavier,dyl_wlc
>
> Hello Selvin, Kalesh, List,
>
> Thank you so much for your patience and guidance throughout this
> process. I truly appreciate you taking the time to review my patches and
> provide detailed feedback - it has been a great learning experience.
>
> I have incorporated all of your suggestions in this v2 version:
> - Added the "rdma-rc" target tree prefix in the subject line
> - Used proper version numbering (v2)
> - Included the changelog below the '---' line as recommended
>
> The updated patch is attached. I believe it now follows all the required
> guidelines. Please let me know if there are any further issues or
> adjustments needed.
>
> The patch is also available on lore.kernel.org here:
> https://lore.kernel.org/all/20250924061444.11288-1-daiyanlong <https://
> lore.kernel.org/all/20250924061444.11288-1-daiyanlong>@kylinos.cn/
>
> Best regards,
> YanLong Dai
>
> ---
>
>
>
>
> *主 题:*Re: [PATCH] RDMA/bnxt_re: Fix a potential memory leak in
> destroy_gsi_sqp
> *日 期:*2025年09月24日13:01
> *发件人:*Kalesh Anakkur Purayil
> *收件人:*Kalesh Anakkur Purayil
> *抄送人:*jgg,leon,linux-kernel,linux-rdma,selvin.xavier,dyl_wlc
>
> Hi YanLong,
> Few generic guidelines.
> 1. You should select a target tree in the subject prefix and specify a
> revision number. Since this is a bug fix, the target tree should be
> "rdma-rc".
> 2. When you send an updated version of the patch, please mention version
> number. Also, mention the changes made in each version. i.e. under ---
> you can add extra info that will not be included in the actual commit,
> e.g. changes between each version of patches.
> One comment in line.
>
> On Mon, Sep 22, 2025 at 7:53 AM YanLong Dai <daiyanlong@kylinos.cn
> <mailto:daiyanlong@kylinos.cn>> wrote:
>
> From: daiyanlong <daiyanlong@kylinos.cn <mailto:daiyanlong@kylinos.cn>>
>
> The current error handling path in bnxt_re_destroy_gsi_sqp() could lead
> to a resource leak. When bnxt_qplib_destroy_qp() fails, the function
> jumps to the 'fail' label and returns immediately, skipping the call
> to bnxt_qplib_free_qp_res().
>
> Continue the resource teardown even if bnxt_qplib_destroy_qp() fails,
> which aligns with the driver's general error handling strategy and
> prevents the potential leak.
>
> Fixes: 8dae419f9ec73 ("RDMA/bnxt_re: Refactor queue pair creation code")
> [Kalesh] Blank line is not needed between Fixes tag and SOB tag
> Signed-off-by: daiyanlong <daiyanlong@kylinos.cn
> <mailto:daiyanlong@kylinos.cn>>
> ---
> drivers/infiniband/hw/bnxt_re/ib_verbs.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/
> infiniband/hw/bnxt_re/ib_verbs.c
> index 260dc67b8b87..15d3f5d5c0ee 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -931,10 +931,9 @@ static int bnxt_re_destroy_gsi_sqp(struct
> bnxt_re_qp *qp)
>
> ibdev_dbg(&rdev->ibdev, "Destroy the shadow QP\n");
> rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &gsi_sqp-
> >qplib_qp);
> - if (rc) {
> + if (rc)
> ibdev_err(&rdev->ibdev, "Destroy Shadow QP failed");
> - goto fail;
> - }
> +
> bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp);
>
> /* remove from active qp list */
> @@ -951,8 +950,6 @@ static int bnxt_re_destroy_gsi_sqp(struct
> bnxt_re_qp *qp)
> rdev->gsi_ctx.sqp_tbl = NULL;
>
> return 0;
> -fail:
> - return rc;
> }
>
> /* Queue Pairs */
> --
> 2.43.0
>
>
> --
> Regards,
> Kalesh AP
>
>
> ---
>
>
> ---
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re:[PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp
2025-09-26 16:11 ` åå¤: " yanjun.zhu
@ 2025-09-28 1:11 ` YanLong Dai
2025-09-28 2:06 ` [PATCH " Zhu Yanjun
0 siblings, 1 reply; 7+ messages in thread
From: YanLong Dai @ 2025-09-28 1:11 UTC (permalink / raw)
To: kalesh-anakkur.purayil, yanjun.zhu
Cc: jgg, leon, daiyanlong, dyl_wlc, linux-kernel, linux-rdma,
selvin.xavier
Hi Kalesh, Yanjun
Thank you both for your time and reviews.
On Wed, Sep 24, 2025 at 10:31:34 +0530, Kalesh wrote:
>Hi YanLong,
>
>Few generic guidelines.
>
>1. You should select a target tree in the subject prefix and specify a revision number. Since this is a bug fix, the target tree should be "rdma-rc".
>2. When you send an updated version of the patch, please mention version number. Also, mention the changes made in each version. i.e. under --- you can add extra info that will not be included in the actual commit, e.g. changes between each version of patches.
>
>One comment in line.
Thank you so much for your patience and guidance throughout this process.
I have incorporated all of your suggestions in this v2 version:
- Added the "rdma-rc" target tree prefix in the subject line
- Used proper version numbering (v2)
- Included the changelog below the '---' line as recommended
Gentle ping on this patch.
For easy reference, the patch is available on lore.kernel.org here:
https://lore.kernel.org/all/20250924061444.11288-1-daiyanlong@kylinos.cn/
---
On Fri, Sep 26, 2025 at 09:11:11AM -0700, Yanjun wrote:
> Hi, YanLong
>
> In regions where Chinese is not supported, the email may appear garbled.
> We recommend replacing any Chinese content in the email with the
> corresponding English to ensure clarity.
>
> Thanks a lot.
> Yanjun.Zhu
Thank you for the reminder.
I have replaced all the Chinese content in my previous email with English to ensure clarity and avoid any encoding issues.
Best regards,
YanLong Dai
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp
2025-09-28 1:11 ` YanLong Dai
@ 2025-09-28 2:06 ` Zhu Yanjun
0 siblings, 0 replies; 7+ messages in thread
From: Zhu Yanjun @ 2025-09-28 2:06 UTC (permalink / raw)
To: YanLong Dai, kalesh-anakkur.purayil
Cc: jgg, leon, dyl_wlc, linux-kernel, linux-rdma, selvin.xavier
在 2025/9/27 18:11, YanLong Dai 写道:
> Hi Kalesh, Yanjun
>
> Thank you both for your time and reviews.
>
> On Wed, Sep 24, 2025 at 10:31:34 +0530, Kalesh wrote:
>> Hi YanLong,
>>
>> Few generic guidelines.
>>
>> 1. You should select a target tree in the subject prefix and specify a revision number. Since this is a bug fix, the target tree should be "rdma-rc".
>> 2. When you send an updated version of the patch, please mention version number. Also, mention the changes made in each version. i.e. under --- you can add extra info that will not be included in the actual commit, e.g. changes between each version of patches.
>>
>> One comment in line.
> Thank you so much for your patience and guidance throughout this process.
>
> I have incorporated all of your suggestions in this v2 version:
> - Added the "rdma-rc" target tree prefix in the subject line
> - Used proper version numbering (v2)
> - Included the changelog below the '---' line as recommended
>
> Gentle ping on this patch.
> For easy reference, the patch is available on lore.kernel.org here:
> https://lore.kernel.org/all/20250924061444.11288-1-daiyanlong@kylinos.cn/
>
>
> ---
>
>
> On Fri, Sep 26, 2025 at 09:11:11AM -0700, Yanjun wrote:
>> Hi, YanLong
>>
>> In regions where Chinese is not supported, the email may appear garbled.
>> We recommend replacing any Chinese content in the email with the
>> corresponding English to ensure clarity.
>>
>> Thanks a lot.
>> Yanjun.Zhu
> Thank you for the reminder.
> I have replaced all the Chinese content in my previous email with English to ensure clarity and avoid any encoding issues.
Thanks a lot. The mail looks better. I am fine with this.
Yanjun.Zhu
>
>
> Best regards,
> YanLong Dai
>
--
Best Regards,
Yanjun.Zhu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp
2025-09-24 6:14 YanLong Dai
@ 2025-10-19 10:48 ` Leon Romanovsky
0 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2025-10-19 10:48 UTC (permalink / raw)
To: kalesh-anakkur.purayil, YanLong Dai
Cc: jgg, linux-kernel, linux-rdma, selvin.xavier, dyl_wlc
On Wed, 24 Sep 2025 14:14:44 +0800, YanLong Dai wrote:
> The current error handling path in bnxt_re_destroy_gsi_sqp() could lead
> to a resource leak. When bnxt_qplib_destroy_qp() fails, the function
> jumps to the 'fail' label and returns immediately, skipping the call
> to bnxt_qplib_free_qp_res().
>
> Continue the resource teardown even if bnxt_qplib_destroy_qp() fails,
> which aligns with the driver's general error handling strategy and
> prevents the potential leak.
>
> [...]
Applied, thanks!
[1/1] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp
https://git.kernel.org/rdma/rdma/c/88de89f184661e
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-10-19 10:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26 2:39 回复: Re: [PATCH v2 rdma-rc] RDMA/bnxt_re: Fix a potential memory leak in destroy_gsi_sqp 代彦龙
2025-09-26 16:11 ` åå¤: " yanjun.zhu
2025-09-28 1:11 ` YanLong Dai
2025-09-28 2:06 ` [PATCH " Zhu Yanjun
-- strict thread matches above, loose matches on Subject: below --
2025-09-24 6:33 代彦龙
2025-09-24 6:14 YanLong Dai
2025-10-19 10:48 ` 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).