From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Mon, 04 Jul 2016 07:45:01 +0000 Subject: [patch] drm/tegra: sor: Double free on error Message-Id: <20160704074501.GA4849@mwanda> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Thierry Reding Cc: David Airlie , Stephen Warren , Alexandre Courbot , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org "brick" is allocated with devm_kzalloc() so freeing it with kfree() leads to a double free. We can just delete it. Fixes: a7ba8310c7f5 ('drm/tegra: sor: Implement sor1_brick clock') Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 8425eda..e750ced 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -345,7 +345,6 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor, { struct tegra_clk_sor_brick *brick; struct clk_init_data init; - struct clk *clk; brick = devm_kzalloc(sor->dev, sizeof(*brick), GFP_KERNEL); if (!brick) @@ -361,11 +360,7 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor, brick->hw.init = &init; - clk = devm_clk_register(sor->dev, &brick->hw); - if (IS_ERR(clk)) - kfree(brick); - - return clk; + return devm_clk_register(sor->dev, &brick->hw); } static int tegra_sor_dp_train_fast(struct tegra_sor *sor, From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [patch] drm/tegra: sor: Double free on error Date: Mon, 4 Jul 2016 10:45:01 +0300 Message-ID: <20160704074501.GA4849@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Thierry Reding Cc: David Airlie , Stephen Warren , Alexandre Courbot , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-tegra@vger.kernel.org "brick" is allocated with devm_kzalloc() so freeing it with kfree() leads to a double free. We can just delete it. Fixes: a7ba8310c7f5 ('drm/tegra: sor: Implement sor1_brick clock') Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 8425eda..e750ced 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -345,7 +345,6 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor, { struct tegra_clk_sor_brick *brick; struct clk_init_data init; - struct clk *clk; brick = devm_kzalloc(sor->dev, sizeof(*brick), GFP_KERNEL); if (!brick) @@ -361,11 +360,7 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor, brick->hw.init = &init; - clk = devm_clk_register(sor->dev, &brick->hw); - if (IS_ERR(clk)) - kfree(brick); - - return clk; + return devm_clk_register(sor->dev, &brick->hw); } static int tegra_sor_dp_train_fast(struct tegra_sor *sor, From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932305AbcGDHpW (ORCPT ); Mon, 4 Jul 2016 03:45:22 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:26733 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932203AbcGDHpU (ORCPT ); Mon, 4 Jul 2016 03:45:20 -0400 Date: Mon, 4 Jul 2016 10:45:01 +0300 From: Dan Carpenter To: Thierry Reding Cc: David Airlie , Stephen Warren , Alexandre Courbot , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] drm/tegra: sor: Double free on error Message-ID: <20160704074501.GA4849@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "brick" is allocated with devm_kzalloc() so freeing it with kfree() leads to a double free. We can just delete it. Fixes: a7ba8310c7f5 ('drm/tegra: sor: Implement sor1_brick clock') Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 8425eda..e750ced 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -345,7 +345,6 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor, { struct tegra_clk_sor_brick *brick; struct clk_init_data init; - struct clk *clk; brick = devm_kzalloc(sor->dev, sizeof(*brick), GFP_KERNEL); if (!brick) @@ -361,11 +360,7 @@ static struct clk *tegra_clk_sor_brick_register(struct tegra_sor *sor, brick->hw.init = &init; - clk = devm_clk_register(sor->dev, &brick->hw); - if (IS_ERR(clk)) - kfree(brick); - - return clk; + return devm_clk_register(sor->dev, &brick->hw); } static int tegra_sor_dp_train_fast(struct tegra_sor *sor,