From patchwork Mon Jan 7 01:05:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1938311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 8E1B5DF2A2 for ; Mon, 7 Jan 2013 01:06:34 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Ts183-0005ft-Ly; Mon, 07 Jan 2013 01:03:51 +0000 Received: from perceval.ideasonboard.com ([95.142.166.194]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Ts17z-0005fb-GW for linux-arm-kernel@lists.infradead.org; Mon, 07 Jan 2013 01:03:48 +0000 Received: from avalon.ideasonboard.com (unknown [91.178.25.187]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2C330359DC; Mon, 7 Jan 2013 02:03:46 +0100 (CET) From: Laurent Pinchart To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] clk: max77686: Avoid double free at remove time Date: Mon, 7 Jan 2013 02:05:19 +0100 Message-Id: <1357520719-3782-1-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130106_200347_725663_CBFDB8A5 X-CRM114-Status: UNSURE ( 9.97 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jonghwa Lee , Mike Turquette X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 --- 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;