Skip to content

Commit 2bf1877

Browse files
GoodLuck612ij-intel
authored andcommitted
platform/x86/amd: Fix memory leak in wbrf_record()
The tmp buffer is allocated using kcalloc() but is not freed if acpi_evaluate_dsm() fails. This causes a memory leak in the error path. Fix this by explicitly freeing the tmp buffer in the error handling path of acpi_evaluate_dsm(). Fixes: 58e82a6 ("platform/x86/amd: Add support for AMD ACPI based Wifi band RFI mitigation feature") Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Co-developed-by: Jianhao Xu <jianhao.xu@seu.edu.cn> Signed-off-by: Jianhao Xu <jianhao.xu@seu.edu.cn> Signed-off-by: Zilin Guan <zilin@seu.edu.cn> Link: https://patch.msgid.link/20260106091318.747019-1-zilin@seu.edu.cn Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 3113bcf commit 2bf1877

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • drivers/platform/x86/amd

drivers/platform/x86/amd/wbrf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ static int wbrf_record(struct acpi_device *adev, uint8_t action, struct wbrf_ran
104104
obj = acpi_evaluate_dsm(adev->handle, &wifi_acpi_dsm_guid,
105105
WBRF_REVISION, WBRF_RECORD, &argv4);
106106

107-
if (!obj)
107+
if (!obj) {
108+
kfree(tmp);
108109
return -EINVAL;
110+
}
109111

110112
if (obj->type != ACPI_TYPE_INTEGER) {
111113
ret = -EINVAL;

0 commit comments

Comments
 (0)