Skip to content

Commit 661e5eb

Browse files
yuliao0214Paolo Abeni
authored andcommitted
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: 46b903a ("net, thunder, bgx: Add support to get MAC address from ACPI.") Signed-off-by: Yu Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent ad17c2a commit 661e5eb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/cavium/thunder/thunder_bgx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,8 +1436,10 @@ static acpi_status bgx_acpi_match_id(acpi_handle handle, u32 lvl,
14361436
return AE_OK;
14371437
}
14381438

1439-
if (strncmp(string.pointer, bgx_sel, 4))
1439+
if (strncmp(string.pointer, bgx_sel, 4)) {
1440+
kfree(string.pointer);
14401441
return AE_OK;
1442+
}
14411443

14421444
acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
14431445
bgx_acpi_register_phy, NULL, bgx, NULL);

0 commit comments

Comments
 (0)