From: Julia Lawall Date: Sat, 26 Sep 2015 20:18:20 +0000 (+0200) Subject: gpio: max730x: eliminate double free X-Git-Tag: firefly_0821_release~176^2~847^2~35 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7474f23dd05713dacc5f22d309913c96bce1c92b;p=firefly-linux-kernel-4.4.55.git gpio: max730x: eliminate double free 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 Reviewed-by: Alexandre Courbot Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-max730x.c b/drivers/gpio/gpio-max730x.c index 18ab89e20806..0f57d2d248ec 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);