* [PATCH] net: mana: Fix memory leak in mana_hwc_create_wq
@ 2021-12-08 22:37 ` José Expósito
0 siblings, 0 replies; 6+ messages in thread
From: José Expósito @ 2021-12-08 22:37 UTC (permalink / raw)
To: kys
Cc: haiyangz, sthemmin, wei.liu, decui, davem, sumit.semwal,
christian.koenig, linux-hyperv, netdev, linux-kernel,
linux-media, dri-devel, linaro-mm-sig, José Expósito
If allocating the DMA buffer fails, mana_hwc_destroy_wq was called
without previously storing the pointer to the queue.
In order to avoid leaking the pointer to the queue, store it as soon as
it is allocated.
Addresses-Coverity-ID: 1484720 ("Resource leak")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/net/ethernet/microsoft/mana/hw_channel.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c
index 34b971ff8ef8..078d6a5a0768 100644
--- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
+++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c
@@ -480,16 +480,16 @@ static int mana_hwc_create_wq(struct hw_channel_context *hwc,
if (err)
goto out;
- err = mana_hwc_alloc_dma_buf(hwc, q_depth, max_msg_size,
- &hwc_wq->msg_buf);
- if (err)
- goto out;
-
hwc_wq->hwc = hwc;
hwc_wq->gdma_wq = queue;
hwc_wq->queue_depth = q_depth;
hwc_wq->hwc_cq = hwc_cq;
+ err = mana_hwc_alloc_dma_buf(hwc, q_depth, max_msg_size,
+ &hwc_wq->msg_buf);
+ if (err)
+ goto out;
+
*hwc_wq_ptr = hwc_wq;
return 0;
out:
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] net: mana: Fix memory leak in mana_hwc_create_wq
@ 2021-12-08 22:37 ` José Expósito
0 siblings, 0 replies; 6+ messages in thread
From: José Expósito @ 2021-12-08 22:37 UTC (permalink / raw)
To: kys
Cc: wei.liu, sthemmin, christian.koenig, netdev, haiyangz, decui,
linux-hyperv, dri-devel, davem, linaro-mm-sig,
José Expósito, linux-kernel, linux-media
If allocating the DMA buffer fails, mana_hwc_destroy_wq was called
without previously storing the pointer to the queue.
In order to avoid leaking the pointer to the queue, store it as soon as
it is allocated.
Addresses-Coverity-ID: 1484720 ("Resource leak")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/net/ethernet/microsoft/mana/hw_channel.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c
index 34b971ff8ef8..078d6a5a0768 100644
--- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
+++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c
@@ -480,16 +480,16 @@ static int mana_hwc_create_wq(struct hw_channel_context *hwc,
if (err)
goto out;
- err = mana_hwc_alloc_dma_buf(hwc, q_depth, max_msg_size,
- &hwc_wq->msg_buf);
- if (err)
- goto out;
-
hwc_wq->hwc = hwc;
hwc_wq->gdma_wq = queue;
hwc_wq->queue_depth = q_depth;
hwc_wq->hwc_cq = hwc_cq;
+ err = mana_hwc_alloc_dma_buf(hwc, q_depth, max_msg_size,
+ &hwc_wq->msg_buf);
+ if (err)
+ goto out;
+
*hwc_wq_ptr = hwc_wq;
return 0;
out:
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] net: mana: Fix memory leak in mana_hwc_create_wq
2021-12-08 22:37 ` José Expósito
@ 2021-12-09 0:32 ` Dexuan Cui
-1 siblings, 0 replies; 6+ messages in thread
From: Dexuan Cui @ 2021-12-09 0:32 UTC (permalink / raw)
To: José Expósito, KY Srinivasan
Cc: Haiyang Zhang, Stephen Hemminger, wei.liu, davem, sumit.semwal,
christian.koenig, linux-hyperv, netdev, linux-kernel,
linux-media, dri-devel, linaro-mm-sig
> From: José Expósito <jose.exposito89@gmail.com>
> Sent: Wednesday, December 8, 2021 2:37 PM
>
> If allocating the DMA buffer fails, mana_hwc_destroy_wq was called
> without previously storing the pointer to the queue.
>
> In order to avoid leaking the pointer to the queue, store it as soon as
> it is allocated.
>
> Addresses-Coverity-ID: 1484720 ("Resource leak")
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] net: mana: Fix memory leak in mana_hwc_create_wq
@ 2021-12-09 0:32 ` Dexuan Cui
0 siblings, 0 replies; 6+ messages in thread
From: Dexuan Cui @ 2021-12-09 0:32 UTC (permalink / raw)
To: José Expósito, KY Srinivasan
Cc: wei.liu, Stephen Hemminger, davem, netdev, Haiyang Zhang,
linux-hyperv, dri-devel, christian.koenig, linaro-mm-sig,
linux-kernel, linux-media
> From: José Expósito <jose.exposito89@gmail.com>
> Sent: Wednesday, December 8, 2021 2:37 PM
>
> If allocating the DMA buffer fails, mana_hwc_destroy_wq was called
> without previously storing the pointer to the queue.
>
> In order to avoid leaking the pointer to the queue, store it as soon as
> it is allocated.
>
> Addresses-Coverity-ID: 1484720 ("Resource leak")
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: mana: Fix memory leak in mana_hwc_create_wq
2021-12-08 22:37 ` José Expósito
@ 2021-12-09 16:10 ` patchwork-bot+netdevbpf
-1 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-09 16:10 UTC (permalink / raw)
To: =?utf-8?b?Sm9zw6kgRXhww7NzaXRvIDxqb3NlLmV4cG9zaXRvODlAZ21haWwuY29tPg==?=
Cc: kys, haiyangz, sthemmin, wei.liu, decui, davem, sumit.semwal,
christian.koenig, linux-hyperv, netdev, linux-kernel,
linux-media, dri-devel, linaro-mm-sig
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 8 Dec 2021 23:37:23 +0100 you wrote:
> If allocating the DMA buffer fails, mana_hwc_destroy_wq was called
> without previously storing the pointer to the queue.
>
> In order to avoid leaking the pointer to the queue, store it as soon as
> it is allocated.
>
> Addresses-Coverity-ID: 1484720 ("Resource leak")
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
>
> [...]
Here is the summary with links:
- net: mana: Fix memory leak in mana_hwc_create_wq
https://git.kernel.org/netdev/net/c/9acfc57fa2b8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: mana: Fix memory leak in mana_hwc_create_wq
@ 2021-12-09 16:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-09 16:10 UTC (permalink / raw)
To: =?utf-8?b?Sm9zw6kgRXhww7NzaXRvIDxqb3NlLmV4cG9zaXRvODlAZ21haWwuY29tPg==?=
Cc: wei.liu, sthemmin, christian.koenig, netdev, haiyangz, decui,
linux-hyperv, dri-devel, linaro-mm-sig, kys, davem, linux-kernel,
linux-media
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 8 Dec 2021 23:37:23 +0100 you wrote:
> If allocating the DMA buffer fails, mana_hwc_destroy_wq was called
> without previously storing the pointer to the queue.
>
> In order to avoid leaking the pointer to the queue, store it as soon as
> it is allocated.
>
> Addresses-Coverity-ID: 1484720 ("Resource leak")
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
>
> [...]
Here is the summary with links:
- net: mana: Fix memory leak in mana_hwc_create_wq
https://git.kernel.org/netdev/net/c/9acfc57fa2b8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-09 17:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 22:37 [PATCH] net: mana: Fix memory leak in mana_hwc_create_wq José Expósito
2021-12-08 22:37 ` José Expósito
2021-12-09 0:32 ` Dexuan Cui
2021-12-09 0:32 ` Dexuan Cui
2021-12-09 16:10 ` patchwork-bot+netdevbpf
2021-12-09 16:10 ` patchwork-bot+netdevbpf
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.