From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757371Ab3AOBET (ORCPT ); Mon, 14 Jan 2013 20:04:19 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:64431 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755608Ab3AOBER convert rfc822-to-8bit (ORCPT ); Mon, 14 Jan 2013 20:04:17 -0500 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Laurent Pinchart , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Mike Turquette In-Reply-To: <1357520719-3782-1-git-send-email-laurent.pinchart@ideasonboard.com> Cc: Jonghwa Lee References: <1357520719-3782-1-git-send-email-laurent.pinchart@ideasonboard.com> Message-ID: <20130115010410.23734.88154@quantum> User-Agent: alot/0.3.3+ Subject: Re: [PATCH] clk: max77686: Avoid double free at remove time Date: Mon, 14 Jan 2013 17:04:10 -0800 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Laurent Pinchart (2013-01-06 17:05:19) > 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 Hi Laurent, Thanks for the fix. Applied to clk-next. Regards, Mike > --- > drivers/clk/clk-max77686.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c > index d098f72..6de05c5 100644 > --- a/drivers/clk/clk-max77686.c > +++ b/drivers/clk/clk-max77686.c > @@ -130,8 +130,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 (IS_ERR(max77686->lookup)) > return -ENOMEM; > > -- > Regards, > > Laurent Pinchart