Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1865608rwb; Fri, 19 Aug 2022 10:40:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VyRHumDKMuyz4HHLoEuI5epuV0qSPaF7OMye0IpzinBwtLPiP9wQxc6hBazwGfbOlJ12D X-Received: by 2002:a17:902:e80d:b0:16e:f7bf:34a7 with SMTP id u13-20020a170902e80d00b0016ef7bf34a7mr8341414plg.112.1660930841122; Fri, 19 Aug 2022 10:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930841; cv=none; d=google.com; s=arc-20160816; b=y8cRgwQxU+hprvOewAmiq5uGr3w1vLH4ygs+/tmw8dtsfQL6dx1QniwUR1szhgGCfx sAqVEQLaS3/ybtdnd6zFOuD6gF7z2uWeDVmVXND8VpcQXpHJJ7jNYjIGM1sCyWA5n7yf r7NIsy4ws6tupyCwW+vENjjEpA9UYbT2LbjGmX0Ng1Qek2IOejxd9DCxVav9P5gweXsZ nI12V52g/7/x4Vn3xvf/w3R6vyvHDd2ZGyZX9+frSNR8J71ncokt9dXoCXMwWyd0TRMY VuDmwvTw6NjQHssXxGd028fGPg2HTtyaqaWBhXm5XgfuqzKEH4bgYWqhZyAloyVV4BjR Lw5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fJ++He5fJkMLIrPx39DmNAaLunQ0lxd3ojqnqoIKjjw=; b=DBsYWSEwju/7HUHH+fwPzCvmZj/jN6vknnc1xRwObIyu3yjrGMd7+cSQJCH7+AMCm6 YF//DpzAMs9+5CYPWTnIw8wzzUBqBI6qRqNSVYC62UyZLJieP+5JAQFUD60yH82wdceD QirvD8kz6ZmpWjZXb03JQF0EPfZMABKQLtpLl6Zj+IH1oRdaMvMt9rsMr7/4DksVSch1 e/BEK1F0r57QErnKfH3ajvHMKfQBs7uUuaPZx0D19GV2AXMHPjoe8eNaHoEg31gyfej2 rvPZmHKq+gPySq56NinKAz+W9HnNmWeHINNBGNNBgk8ojLycI+SyBbqOWSx/bVjb1mnj lTlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l3GW4zE4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i35-20020a635863000000b00429e092d046si1589859pgm.362.2022.08.19.10.40.29; Fri, 19 Aug 2022 10:40:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l3GW4zE4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351106AbiHSQDe (ORCPT + 99 others); Fri, 19 Aug 2022 12:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351194AbiHSQAy (ORCPT ); Fri, 19 Aug 2022 12:00:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 343EE109A26; Fri, 19 Aug 2022 08:52:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3EFDEB82819; Fri, 19 Aug 2022 15:52:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 843BAC433C1; Fri, 19 Aug 2022 15:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924327; bh=JdOxDb19qhiS+BSMzr2+m+qw4SHjh6WSUT+IaLSa8dE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l3GW4zE4ufoZun1QiAPllTBNbXBRJgPvktLfgSceOoBP3rB45dCKe716FrnZI7Cda O/BkkMDW4NJMj83WFPYdP7tpBJNkvybSV26sOrTsVpuz2k/9fZmk0dB/iR8cE6Wy1L mMGuj4YxbBkqejNOgAlHu6MXoXbCnyHBPE2CyU/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.10 116/545] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c Date: Fri, 19 Aug 2022 17:38:06 +0200 Message-Id: <20220819153834.483199617@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liang He [ Upstream commit d18529a4c12f66d83daac78045ea54063bd43257 ] In meson_secure_pwrc_probe(), there is a refcount leak in one fail path. Signed-off-by: Liang He Acked-by: Martin Blumenstingl Fixes: b3dde5013e13 ("soc: amlogic: Add support for Secure power domains controller") Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220616144915.3988071-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/soc/amlogic/meson-secure-pwrc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/meson-secure-pwrc.c index 5fb29a475879..fff92e2f3974 100644 --- a/drivers/soc/amlogic/meson-secure-pwrc.c +++ b/drivers/soc/amlogic/meson-secure-pwrc.c @@ -138,8 +138,10 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev) } pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); - if (!pwrc) + if (!pwrc) { + of_node_put(sm_np); return -ENOMEM; + } pwrc->fw = meson_sm_get(sm_np); of_node_put(sm_np); -- 2.35.1