linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: max77686: Avoid double free at remove time
@ 2013-01-07  1:05 Laurent Pinchart
  2013-01-15  1:04 ` Mike Turquette
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Pinchart @ 2013-01-07  1:05 UTC (permalink / raw)
  To: linux-arm-kernel

The clk_lookup entry is dropped at remove time by a call to
clkdev_drop(). That function frees the entry, which is also freed by the
driver core as it has been allocated through devm_kzalloc(). This
results in a double free.

Use kzalloc() instead of devm_kzalloc() to fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/clk/clk-max77686.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c
index d098f72..6de05c5 100644
--- a/drivers/clk/clk-max77686.c
+++ b/drivers/clk/clk-max77686.c
@@ -130,8 +130,7 @@ static int max77686_clk_register(struct device *dev,
 	if (IS_ERR(clk))
 		return -ENOMEM;
 
-	max77686->lookup = devm_kzalloc(dev, sizeof(struct clk_lookup),
-					GFP_KERNEL);
+	max77686->lookup = kzalloc(sizeof(struct clk_lookup), GFP_KERNEL);
 	if (IS_ERR(max77686->lookup))
 		return -ENOMEM;
 
-- 
Regards,

Laurent Pinchart

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] clk: max77686: Avoid double free at remove time
  2013-01-07  1:05 [PATCH] clk: max77686: Avoid double free at remove time Laurent Pinchart
@ 2013-01-15  1:04 ` Mike Turquette
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Turquette @ 2013-01-15  1:04 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Laurent Pinchart (2013-01-06 17:05:19)
> The clk_lookup entry is dropped at remove time by a call to
> clkdev_drop(). That function frees the entry, which is also freed by the
> driver core as it has been allocated through devm_kzalloc(). This
> results in a double free.
> 
> Use kzalloc() instead of devm_kzalloc() to fix this.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Hi Laurent,

Thanks for the fix.  Applied to clk-next.

Regards,
Mike

> ---
>  drivers/clk/clk-max77686.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c
> index d098f72..6de05c5 100644
> --- a/drivers/clk/clk-max77686.c
> +++ b/drivers/clk/clk-max77686.c
> @@ -130,8 +130,7 @@ static int max77686_clk_register(struct device *dev,
>         if (IS_ERR(clk))
>                 return -ENOMEM;
>  
> -       max77686->lookup = devm_kzalloc(dev, sizeof(struct clk_lookup),
> -                                       GFP_KERNEL);
> +       max77686->lookup = kzalloc(sizeof(struct clk_lookup), GFP_KERNEL);
>         if (IS_ERR(max77686->lookup))
>                 return -ENOMEM;
>  
> -- 
> Regards,
> 
> Laurent Pinchart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-15  1:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-07  1:05 [PATCH] clk: max77686: Avoid double free at remove time Laurent Pinchart
2013-01-15  1:04 ` Mike Turquette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).