From patchwork Wed Jul 29 20:15:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 6896221 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C86EC05AC for ; Wed, 29 Jul 2015 20:21:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8AA0C2064B for ; Wed, 29 Jul 2015 20:21:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A205A20660 for ; Wed, 29 Jul 2015 20:21:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752911AbbG2UVM (ORCPT ); Wed, 29 Jul 2015 16:21:12 -0400 Received: from li271-223.members.linode.com ([178.79.152.223]:37769 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752025AbbG2UVL (ORCPT ); Wed, 29 Jul 2015 16:21:11 -0400 X-Greylist: delayed 354 seconds by postgrey-1.27 at vger.kernel.org; Wed, 29 Jul 2015 16:21:11 EDT Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id EA019101F13; Wed, 29 Jul 2015 21:20:35 +0100 (BST) Received: from meadow.home (a91-152-106-128.elisa-laajakaista.fi [91.152.106.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mleia.com (Postfix) with ESMTPSA id 7EC8A101F05; Wed, 29 Jul 2015 21:20:35 +0100 (BST) From: Vladimir Zapolskiy To: Kukjin Kim , Krzysztof Kozlowski Cc: Russell King , Marek Szyprowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] ARM: EXYNOS: pd: fix resource deallocation on error path Date: Wed, 29 Jul 2015 23:15:13 +0300 Message-Id: <1438200913-10532-1-git-send-email-vz@mleia.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20150729_212035_983457_9E34AEAE X-CRM114-Status: GOOD ( 10.94 ) Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The change fixes a bug introduced by 2be2a3ff42a5, memory allocated by kstrdup_const() must be always deallocated with kfree_const(), otherwise there is a risk of kfree'ing ro memory. Also remove unneeded of_node_put(), if for_each_compatible_node() body execution is not terminated, this prevents from double kfree() in OF_DYNAMIC build. Signed-off-by: Vladimir Zapolskiy --- arch/arm/mach-exynos/pm_domains.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 6001f1c..4a87e86 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -146,9 +146,8 @@ static __init int exynos4_pm_init_power_domain(void) pd->base = of_iomap(np, 0); if (!pd->base) { pr_warn("%s: failed to map memory\n", __func__); - kfree(pd->pd.name); + kfree_const(pd->pd.name); kfree(pd); - of_node_put(np); continue; }