2018-09-10 18:04:22

by Mario Limonciello

[permalink] [raw]
Subject: [PATCH 1/2] platform/x86: dell-smbios-wmi: Correct a memory leak

ACPI buffers were being allocated but never freed.

Reported-by: Pinzhen Xu <[email protected]>
Signed-off-by: Mario Limonciello <[email protected]>
Cc: [email protected]
---
drivers/platform/x86/dell-smbios-wmi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c
index 88afe56..cf2229e 100644
--- a/drivers/platform/x86/dell-smbios-wmi.c
+++ b/drivers/platform/x86/dell-smbios-wmi.c
@@ -78,6 +78,7 @@ static int run_smbios_call(struct wmi_device *wdev)
dev_dbg(&wdev->dev, "result: [%08x,%08x,%08x,%08x]\n",
priv->buf->std.output[0], priv->buf->std.output[1],
priv->buf->std.output[2], priv->buf->std.output[3]);
+ kfree(output.pointer);

return 0;
}
--
2.7.4



2018-09-10 18:02:47

by Mario Limonciello

[permalink] [raw]
Subject: [PATCH 2/2] platform/x86: alienware-wmi: Correct a memory leak

An ACPI buffer that was allocated was not being freed after use.

Signed-off-by: Mario Limonciello <[email protected]>
Cc: [email protected]
---
drivers/platform/x86/alienware-wmi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
index d975462..f10af5c 100644
--- a/drivers/platform/x86/alienware-wmi.c
+++ b/drivers/platform/x86/alienware-wmi.c
@@ -536,6 +536,7 @@ static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args,
if (obj && obj->type == ACPI_TYPE_INTEGER)
*out_data = (u32) obj->integer.value;
}
+ kfree(output.pointer);
return status;

}
--
2.7.4


2018-09-10 20:52:04

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH 1/2] platform/x86: dell-smbios-wmi: Correct a memory leak

On Mon, Sep 10, 2018 at 01:01:52PM -0500, Mario Limonciello wrote:
> ACPI buffers were being allocated but never freed.
>
> Reported-by: Pinzhen Xu <[email protected]>
> Signed-off-by: Mario Limonciello <[email protected]>
> Cc: [email protected]

Thanks Mario and Pinzhen, both queued. That's an easy one to miss, the usage not
being particularly obvious.

> ---
> drivers/platform/x86/dell-smbios-wmi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c
> index 88afe56..cf2229e 100644
> --- a/drivers/platform/x86/dell-smbios-wmi.c
> +++ b/drivers/platform/x86/dell-smbios-wmi.c
> @@ -78,6 +78,7 @@ static int run_smbios_call(struct wmi_device *wdev)
> dev_dbg(&wdev->dev, "result: [%08x,%08x,%08x,%08x]\n",
> priv->buf->std.output[0], priv->buf->std.output[1],
> priv->buf->std.output[2], priv->buf->std.output[3]);
> + kfree(output.pointer);
>
> return 0;
> }
> --
> 2.7.4
>
>

--
Darren Hart
VMware Open Source Technology Center

2018-09-12 12:16:01

by Mario Limonciello

[permalink] [raw]
Subject: RE: [PATCH 1/2] platform/x86: dell-smbios-wmi: Correct a memory leak

Darren,

> -----Original Message-----
> From: Darren Hart [mailto:[email protected]]
> Sent: Monday, September 10, 2018 3:52 PM
> To: Limonciello, Mario
> Cc: Andy Shevchenko; LKML; [email protected];
> [email protected]
> Subject: Re: [PATCH 1/2] platform/x86: dell-smbios-wmi: Correct a memory leak
>
> On Mon, Sep 10, 2018 at 01:01:52PM -0500, Mario Limonciello wrote:
> > ACPI buffers were being allocated but never freed.
> >
> > Reported-by: Pinzhen Xu <[email protected]>
> > Signed-off-by: Mario Limonciello <[email protected]>
> > Cc: [email protected]
>
> Thanks Mario and Pinzhen, both queued. That's an easy one to miss, the usage not
> being particularly obvious.
>

This cropped up and is fixed by that patch:
https://github.com/dell/libsmbios/issues/63

Given the impact and how small the patch is, I think it might be good if this can come to 4.19-rcX if possible.
Thoughts?

I suspect this one might be the same issue too:
https://bugzilla.redhat.com/show_bug.cgi?id=1627609



2018-09-12 16:07:38

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH 1/2] platform/x86: dell-smbios-wmi: Correct a memory leak

On Wed, Sep 12, 2018 at 12:14:34PM +0000, [email protected] wrote:
> Darren,
>
> > -----Original Message-----
> > From: Darren Hart [mailto:[email protected]]
> > Sent: Monday, September 10, 2018 3:52 PM
> > To: Limonciello, Mario
> > Cc: Andy Shevchenko; LKML; [email protected];
> > [email protected]
> > Subject: Re: [PATCH 1/2] platform/x86: dell-smbios-wmi: Correct a memory leak
> >
> > On Mon, Sep 10, 2018 at 01:01:52PM -0500, Mario Limonciello wrote:
> > > ACPI buffers were being allocated but never freed.
> > >
> > > Reported-by: Pinzhen Xu <[email protected]>
> > > Signed-off-by: Mario Limonciello <[email protected]>
> > > Cc: [email protected]
> >
> > Thanks Mario and Pinzhen, both queued. That's an easy one to miss, the usage not
> > being particularly obvious.
> >
>
> This cropped up and is fixed by that patch:
> https://github.com/dell/libsmbios/issues/63
>
> Given the impact and how small the patch is, I think it might be good if this can come to 4.19-rcX if possible.
> Thoughts?
>
> I suspect this one might be the same issue too:
> https://bugzilla.redhat.com/show_bug.cgi?id=1627609


Happy to pull these into fixes for 4.19-rcX. Queued to Fixes.

--
Darren Hart
VMware Open Source Technology Center