linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: max730x: eliminate double free
@ 2015-09-26 20:18 Julia Lawall
  2015-09-28  1:44 ` Alexandre Courbot
  2015-10-02 21:48 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Julia Lawall @ 2015-09-26 20:18 UTC (permalink / raw)
  To: Linus Walleij
  Cc: kernel-janitors, Alexandre Courbot, linux-gpio, linux-kernel

The function __max730x_remove is called from the remove functions of
drivers/gpio/gpio-max7300.c and drivers/gpio/gpio-max7301.c.  In both
cases, the probe function allocates ts using devm_kzalloc.  Explicitly
freeing such a value with kfree will cause a double free.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/gpio/gpio-max730x.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpio/gpio-max730x.c b/drivers/gpio/gpio-max730x.c
index 18ab89e..0f57d2d 100644
--- a/drivers/gpio/gpio-max730x.c
+++ b/drivers/gpio/gpio-max730x.c
@@ -236,7 +236,6 @@ int __max730x_remove(struct device *dev)
 	ts->write(dev, 0x04, 0x00);
 	gpiochip_remove(&ts->chip);
 	mutex_destroy(&ts->lock);
-	kfree(ts);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(__max730x_remove);


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

* Re: [PATCH] gpio: max730x: eliminate double free
  2015-09-26 20:18 [PATCH] gpio: max730x: eliminate double free Julia Lawall
@ 2015-09-28  1:44 ` Alexandre Courbot
  2015-10-02 21:48 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2015-09-28  1:44 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Linus Walleij, kernel-janitors, linux-gpio, Linux Kernel Mailing List

On Sun, Sep 27, 2015 at 5:18 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> The function __max730x_remove is called from the remove functions of
> drivers/gpio/gpio-max7300.c and drivers/gpio/gpio-max7301.c.  In both
> cases, the probe function allocates ts using devm_kzalloc.  Explicitly
> freeing such a value with kfree will cause a double free.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

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

* Re: [PATCH] gpio: max730x: eliminate double free
  2015-09-26 20:18 [PATCH] gpio: max730x: eliminate double free Julia Lawall
  2015-09-28  1:44 ` Alexandre Courbot
@ 2015-10-02 21:48 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-10-02 21:48 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Alexandre Courbot, linux-gpio, linux-kernel

On Sat, Sep 26, 2015 at 1:18 PM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:

> The function __max730x_remove is called from the remove functions of
> drivers/gpio/gpio-max7300.c and drivers/gpio/gpio-max7301.c.  In both
> cases, the probe function allocates ts using devm_kzalloc.  Explicitly
> freeing such a value with kfree will cause a double free.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Patch applied with Alex' review-tag.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-10-02 21:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-26 20:18 [PATCH] gpio: max730x: eliminate double free Julia Lawall
2015-09-28  1:44 ` Alexandre Courbot
2015-10-02 21:48 ` Linus Walleij

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).