[PATCH] driver core: location: Free struct acpi_pld_info *pld

Won Chung posted 1 patch 4 years, 1 month ago
drivers/base/physical_location.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] driver core: location: Free struct acpi_pld_info *pld
Posted by Won Chung 4 years, 1 month ago
After struct acpi_pld_info *pld is used to fill in physical location
values, it should be freed to prevent memleak.

Suggested-by: Yu Watanabe <watanabe.yu@gmail.com>
Signed-off-by: Won Chung <wonchung@google.com>
---
 drivers/base/physical_location.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/physical_location.c b/drivers/base/physical_location.c
index fbd9f9839e92..617ada542b00 100644
--- a/drivers/base/physical_location.c
+++ b/drivers/base/physical_location.c
@@ -32,6 +32,7 @@ bool dev_add_physical_location(struct device *dev)
 	dev->physical_location->dock = pld->dock;
 	dev->physical_location->lid = pld->lid;
 
+	ACPI_FREE(pld);
 	return true;
 }
 
-- 
2.36.0.512.ge40c2bad7a-goog
Re: [PATCH] driver core: location: Free struct acpi_pld_info *pld
Posted by Greg Kroah-Hartman 4 years ago
On Mon, May 09, 2022 at 05:31:35PM +0000, Won Chung wrote:
> After struct acpi_pld_info *pld is used to fill in physical location
> values, it should be freed to prevent memleak.
> 
> Suggested-by: Yu Watanabe <watanabe.yu@gmail.com>
> Signed-off-by: Won Chung <wonchung@google.com>
> ---
>  drivers/base/physical_location.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/base/physical_location.c b/drivers/base/physical_location.c
> index fbd9f9839e92..617ada542b00 100644
> --- a/drivers/base/physical_location.c
> +++ b/drivers/base/physical_location.c
> @@ -32,6 +32,7 @@ bool dev_add_physical_location(struct device *dev)
>  	dev->physical_location->dock = pld->dock;
>  	dev->physical_location->lid = pld->lid;
>  
> +	ACPI_FREE(pld);
>  	return true;
>  }
>  
> -- 
> 2.36.0.512.ge40c2bad7a-goog
> 

What commit id does this fix?  Please add that and resend.

thanks,
greg k-h
Re: [PATCH] driver core: location: Free struct acpi_pld_info *pld
Posted by Greg Kroah-Hartman 4 years ago
On Thu, May 19, 2022 at 06:51:13PM +0200, Greg Kroah-Hartman wrote:
> On Mon, May 09, 2022 at 05:31:35PM +0000, Won Chung wrote:
> > After struct acpi_pld_info *pld is used to fill in physical location
> > values, it should be freed to prevent memleak.
> > 
> > Suggested-by: Yu Watanabe <watanabe.yu@gmail.com>
> > Signed-off-by: Won Chung <wonchung@google.com>
> > ---
> >  drivers/base/physical_location.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/base/physical_location.c b/drivers/base/physical_location.c
> > index fbd9f9839e92..617ada542b00 100644
> > --- a/drivers/base/physical_location.c
> > +++ b/drivers/base/physical_location.c
> > @@ -32,6 +32,7 @@ bool dev_add_physical_location(struct device *dev)
> >  	dev->physical_location->dock = pld->dock;
> >  	dev->physical_location->lid = pld->lid;
> >  
> > +	ACPI_FREE(pld);
> >  	return true;
> >  }
> >  
> > -- 
> > 2.36.0.512.ge40c2bad7a-goog
> > 
> 
> What commit id does this fix?  Please add that and resend.
> 
> thanks,
> greg k-h

Nevermind, I'll take it as-is.