diff mbox series

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

Message ID 1536602513-13861-1-git-send-email-mario.limonciello@dell.com (mailing list archive)
State Accepted, archived
Delegated to: Darren Hart
Headers show
Series [1/2] platform/x86: dell-smbios-wmi: Correct a memory leak | expand

Commit Message

Limonciello, Mario Sept. 10, 2018, 6:01 p.m. UTC
ACPI buffers were being allocated but never freed.

Reported-by: Pinzhen Xu <pinzhen.xu@intel.com>
Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Cc: stable@vger.kernel.org
---
 drivers/platform/x86/dell-smbios-wmi.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Darren Hart Sept. 10, 2018, 8:51 p.m. UTC | #1
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 <pinzhen.xu@intel.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> Cc: stable@vger.kernel.org

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
> 
>
Limonciello, Mario Sept. 12, 2018, 12:14 p.m. UTC | #2
Darren,

> -----Original Message-----
> From: Darren Hart [mailto:dvhart@infradead.org]
> Sent: Monday, September 10, 2018 3:52 PM
> To: Limonciello, Mario
> Cc: Andy Shevchenko; LKML; platform-driver-x86@vger.kernel.org;
> stable@vger.kernel.org
> 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 <pinzhen.xu@intel.com>
> > Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> > Cc: stable@vger.kernel.org
> 
> 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
Darren Hart Sept. 12, 2018, 4:06 p.m. UTC | #3
On Wed, Sep 12, 2018 at 12:14:34PM +0000, Mario.Limonciello@dell.com wrote:
> Darren,
> 
> > -----Original Message-----
> > From: Darren Hart [mailto:dvhart@infradead.org]
> > Sent: Monday, September 10, 2018 3:52 PM
> > To: Limonciello, Mario
> > Cc: Andy Shevchenko; LKML; platform-driver-x86@vger.kernel.org;
> > stable@vger.kernel.org
> > 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 <pinzhen.xu@intel.com>
> > > Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> > > Cc: stable@vger.kernel.org
> > 
> > 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.
diff mbox series

Patch

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;
 }