netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: thunderx: Fix the ACPI memory leak
@ 2022-11-23  8:22 Yu Liao
  2022-11-24  9:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Yu Liao @ 2022-11-23  8:22 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, david.daney, tomasz.nowicki,
	rrichter
  Cc: liaoyu15, liwei391, netdev

The ACPI buffer memory (string.pointer) should be freed as the buffer is
not used after returning from bgx_acpi_match_id(), free it to prevent
memory leak.

Fixes: 46b903a01c05 ("net, thunder, bgx: Add support to get MAC address from ACPI.")
Signed-off-by: Yu Liao <liaoyu15@huawei.com>
---
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 2f6484dc186a..7eb2ddbe9bad 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1436,8 +1436,10 @@ static acpi_status bgx_acpi_match_id(acpi_handle handle, u32 lvl,
 		return AE_OK;
 	}
 
-	if (strncmp(string.pointer, bgx_sel, 4))
+	if (strncmp(string.pointer, bgx_sel, 4)) {
+		kfree(string.pointer);
 		return AE_OK;
+	}
 
 	acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
 			    bgx_acpi_register_phy, NULL, bgx, NULL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: thunderx: Fix the ACPI memory leak
  2022-11-23  8:22 [PATCH] net: thunderx: Fix the ACPI memory leak Yu Liao
@ 2022-11-24  9:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-24  9:30 UTC (permalink / raw)
  To: Yu Liao
  Cc: davem, edumazet, kuba, pabeni, david.daney, tomasz.nowicki,
	rrichter, liwei391, netdev

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 23 Nov 2022 16:22:36 +0800 you wrote:
> The ACPI buffer memory (string.pointer) should be freed as the buffer is
> not used after returning from bgx_acpi_match_id(), free it to prevent
> memory leak.
> 
> Fixes: 46b903a01c05 ("net, thunder, bgx: Add support to get MAC address from ACPI.")
> Signed-off-by: Yu Liao <liaoyu15@huawei.com>
> 
> [...]

Here is the summary with links:
  - net: thunderx: Fix the ACPI memory leak
    https://git.kernel.org/netdev/net/c/661e5ebbafd2

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] 2+ messages in thread

end of thread, other threads:[~2022-11-24  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23  8:22 [PATCH] net: thunderx: Fix the ACPI memory leak Yu Liao
2022-11-24  9:30 ` patchwork-bot+netdevbpf

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).