Commit 661e5ebb authored by Yu Liao's avatar Yu Liao Committed by Paolo Abeni

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: 46b903a0 ("net, thunder, bgx: Add support to get MAC address from ACPI.")
Signed-off-by: default avatarYu Liao <liaoyu15@huawei.com>
Link: https://lore.kernel.org/r/20221123082237.1220521-1-liaoyu15@huawei.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent ad17c2a3
...@@ -1436,8 +1436,10 @@ static acpi_status bgx_acpi_match_id(acpi_handle handle, u32 lvl, ...@@ -1436,8 +1436,10 @@ static acpi_status bgx_acpi_match_id(acpi_handle handle, u32 lvl,
return AE_OK; return AE_OK;
} }
if (strncmp(string.pointer, bgx_sel, 4)) if (strncmp(string.pointer, bgx_sel, 4)) {
kfree(string.pointer);
return AE_OK; return AE_OK;
}
acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
bgx_acpi_register_phy, NULL, bgx, NULL); bgx_acpi_register_phy, NULL, bgx, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment