Commit 727cc014 authored by Yu Liao's avatar Yu Liao Committed by Hans de Goede

platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]()

The ACPI buffer memory (out.pointer) returned by wmi_evaluate_method()
is not freed after the call, so it leads to memory leak.

The method results in ACPI buffer is not used, so just pass NULL to
wmi_evaluate_method() which fixes the memory leak.

Fixes: 99b38b4a ("platform/x86: add MXM WMI driver.")
Signed-off-by: default avatarYu Liao <liaoyu15@huawei.com>
Link: https://lore.kernel.org/r/20221129011101.2042315-1-liaoyu15@huawei.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent b03ae77e
...@@ -35,13 +35,11 @@ int mxm_wmi_call_mxds(int adapter) ...@@ -35,13 +35,11 @@ int mxm_wmi_call_mxds(int adapter)
.xarg = 1, .xarg = 1,
}; };
struct acpi_buffer input = { (acpi_size)sizeof(args), &args }; struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
acpi_status status; acpi_status status;
printk("calling mux switch %d\n", adapter); printk("calling mux switch %d\n", adapter);
status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
&output);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return status; return status;
...@@ -60,13 +58,11 @@ int mxm_wmi_call_mxmx(int adapter) ...@@ -60,13 +58,11 @@ int mxm_wmi_call_mxmx(int adapter)
.xarg = 1, .xarg = 1,
}; };
struct acpi_buffer input = { (acpi_size)sizeof(args), &args }; struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
acpi_status status; acpi_status status;
printk("calling mux switch %d\n", adapter); printk("calling mux switch %d\n", adapter);
status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
&output);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return status; return status;
......
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