Skip to content

Commit

Permalink
clk: max77686: Avoid double free at remove time
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Laurent Pinchart authored and Mike Turquette committed Jan 16, 2013
1 parent e4eda8e commit f1ba28a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/clk/clk-max77686.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,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 (!max77686->lookup)
return -ENOMEM;

Expand Down

0 comments on commit f1ba28a

Please sign in to comment.