Skip to content

Commit 3cf8150

Browse files
yuliao0214gregkh
authored andcommitted
platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]()
[ Upstream commit 727cc01 ] 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: 99b38b4 ("platform/x86: add MXM WMI driver.") Signed-off-by: Yu Liao <liaoyu15@huawei.com> Link: https://lore.kernel.org/r/20221129011101.2042315-1-liaoyu15@huawei.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0ceadb5 commit 3cf8150

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/platform/x86/mxm-wmi.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ int mxm_wmi_call_mxds(int adapter)
3535
.xarg = 1,
3636
};
3737
struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
38-
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
3938
acpi_status status;
4039

4140
printk("calling mux switch %d\n", adapter);
4241

43-
status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
44-
&output);
42+
status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
4543

4644
if (ACPI_FAILURE(status))
4745
return status;
@@ -60,13 +58,11 @@ int mxm_wmi_call_mxmx(int adapter)
6058
.xarg = 1,
6159
};
6260
struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
63-
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
6461
acpi_status status;
6562

6663
printk("calling mux switch %d\n", adapter);
6764

68-
status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
69-
&output);
65+
status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
7066

7167
if (ACPI_FAILURE(status))
7268
return status;

0 commit comments

Comments
 (0)