Browse files

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 <>
Signed-off-by: Mike Turquette <>
  • Loading branch information...
1 parent e4eda8e commit f1ba28a1f0fa16f3d0e78d199f3f9bf13e2d487b @pinchartl pinchartl committed with Mike Turquette Jan 7, 2013
Showing with 1 addition and 2 deletions.
  1. +1 −2 drivers/clk/clk-max77686.c
@@ -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),
+ max77686->lookup = kzalloc(sizeof(struct clk_lookup), GFP_KERNEL);
if (!max77686->lookup)
return -ENOMEM;

0 comments on commit f1ba28a

Please sign in to comment.