From: Hans de Goede <hdegoede@redhat.com>
To: Yu Liao <liaoyu15@huawei.com>, markgross@kernel.org
Cc: airlied@redhat.com, mjg@redhat.com,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, liwei391@huawei.com
Subject: Re: [PATCH] platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]()
Date: Thu, 8 Dec 2022 16:32:45 +0100 [thread overview]
Message-ID: <87f62d40-9b2d-8a99-0758-cf2a482ef56d@redhat.com> (raw)
In-Reply-To: <20221129011101.2042315-1-liaoyu15@huawei.com>
Hi,
On 11/29/22 02:11, Yu Liao wrote:
> 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: 99b38b4acc0d ("platform/x86: add MXM WMI driver.")
> Signed-off-by: Yu Liao <liaoyu15@huawei.com>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/mxm-wmi.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/x86/mxm-wmi.c b/drivers/platform/x86/mxm-wmi.c
> index 9a19fbd2f734..9a457956025a 100644
> --- a/drivers/platform/x86/mxm-wmi.c
> +++ b/drivers/platform/x86/mxm-wmi.c
> @@ -35,13 +35,11 @@ int mxm_wmi_call_mxds(int adapter)
> .xarg = 1,
> };
> struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
> - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> acpi_status status;
>
> printk("calling mux switch %d\n", adapter);
>
> - status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
> - &output);
> + status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
>
> if (ACPI_FAILURE(status))
> return status;
> @@ -60,13 +58,11 @@ int mxm_wmi_call_mxmx(int adapter)
> .xarg = 1,
> };
> struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
> - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> acpi_status status;
>
> printk("calling mux switch %d\n", adapter);
>
> - status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
> - &output);
> + status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
>
> if (ACPI_FAILURE(status))
> return status;
prev parent reply other threads:[~2022-12-08 15:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 1:11 [PATCH] platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]() Yu Liao
2022-12-08 15:32 ` Hans de Goede [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87f62d40-9b2d-8a99-0758-cf2a482ef56d@redhat.com \
--to=hdegoede@redhat.com \
--cc=airlied@redhat.com \
--cc=liaoyu15@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liwei391@huawei.com \
--cc=markgross@kernel.org \
--cc=mjg@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox