summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYu Liao <liaoyu15@huawei.com>2022-11-23 11:22:36 +0300
committerPaolo Abeni <pabeni@redhat.com>2022-11-24 12:15:47 +0300
commit661e5ebbafd26d9d2e3c749f5cf591e55c7364f5 (patch)
tree21e9821d8d1532afde727ce41fe528ae70b7e4d7 /drivers
parentad17c2a3f11b0f6b122e7842d8f7d9a5fcc7ac63 (diff)
downloadlinux-661e5ebbafd26d9d2e3c749f5cf591e55c7364f5.tar.xz
net: thunderx: Fix the ACPI memory leak
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> Link: https://lore.kernel.org/r/20221123082237.1220521-1-liaoyu15@huawei.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/cavium/thunder/thunder_bgx.c4
1 files changed, 3 insertions, 1 deletions
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);