Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: max77686: Avoid double free at remove time

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>
Signed-off-by: Mike Turquette <mturquette@linaro.org>

authored by

Laurent Pinchart and committed by
Mike Turquette
f1ba28a1 e4eda8e0

+1 -2
+1 -2
drivers/clk/clk-max77686.c
··· 116 116 if (IS_ERR(clk)) 117 117 return -ENOMEM; 118 118 119 - max77686->lookup = devm_kzalloc(dev, sizeof(struct clk_lookup), 120 - GFP_KERNEL); 119 + max77686->lookup = kzalloc(sizeof(struct clk_lookup), GFP_KERNEL); 121 120 if (!max77686->lookup) 122 121 return -ENOMEM; 123 122