Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3080386rwb; Mon, 15 Aug 2022 17:38:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR6RrDLTErNKARrF9AR4UCJ/sLx8UtFKusLuL2QQqLBlB2Rqclxrj9/xYPqeupX6KzPKVP5u X-Received: by 2002:a17:907:3da2:b0:731:55b2:1c20 with SMTP id he34-20020a1709073da200b0073155b21c20mr11351292ejc.742.1660610301776; Mon, 15 Aug 2022 17:38:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610301; cv=none; d=google.com; s=arc-20160816; b=nNeyVIVzLqse8pTPhfBtFCPy4b9zNMZl2gZPdGp3x5JCoOs6/css8XHhEcRNLW2jFw LryrLdCvkxnMbjOD1RQUPqGCCZ/E4BE/HL806mODWF+9iVdJcbaOc0xomyGgT2qppOLo zWcPyPcaF8mYkWTXsUy07b9wbptEt+jB2MNDP7wZhQ5rwPxifynMm6HrkWceMJVzAQaQ 5jtczs6o51RtVMxwSATpR6PWk7TCybSJ/nKI4daS+fQgi/97YDKIiKP6eRyiQz+bMcgA IEJuY5Myd0KEhbBrywFu4rO+rUrIk2kjTKOeHk+4+TDClENB7cv/mfBrh035CKfDX4ch vLRQ== 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=15OS3iRKh71hy6qVKnC52H+/4McQdIhWXeWst8YVz2o=; b=R20XMMqf38o9GCjtGr5KSrBoakdpxkTIVGQvqHaE8OW4DJMPuACIKJlQ8A3RCQVT0C 7WG0xhldE2KigZvvjTNjouJqz7SOYazKamCYqhkP6ABuAwQyBeTA2GGmq1K+DoOLKyW+ 7iSQuZ5SVTUm8IiEIU45wrDdVmdVMpKKgKkrcea1Hc5Py4+K9h/RmmFIOD5RL31g3ioS lNzN1AvLojnR1Q3n3VnQvmNmcDNAXWHy5JedhFHjgH2opkYkWhUpVlHDxXi9oxapeJi/ O8ZxMWRj8J4PRpZe9tPvuht/PBm7zyj6auhhBdRzwuCo6m3w4iD2k7tRgvgXauhIknjv P0jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dg9ZUs2z; 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 i24-20020a1709067a5800b0072efd2ebeecsi10194733ejo.785.2022.08.15.17.37.55; Mon, 15 Aug 2022 17:38:21 -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=Dg9ZUs2z; 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 S1350465AbiHOWoS (ORCPT + 99 others); Mon, 15 Aug 2022 18:44:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350467AbiHOWjd (ORCPT ); Mon, 15 Aug 2022 18:39:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A1374DB0E; Mon, 15 Aug 2022 12:51:26 -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 E3468B80EA9; Mon, 15 Aug 2022 19:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3820AC433D6; Mon, 15 Aug 2022 19:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593084; bh=ROhcCfIKrzYI/OpUhfYzvakQSe0wUMT4P7K7njz8oqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dg9ZUs2z0IZYkNCMDWh77hs50jG528Du2BNFpSP+fiuA1KG8ltMB01Dt12HNFopqQ 8we2eidsHtP/GAtjCN6iPaQdkXSJvSS8pj5S5w5JIsy+qd4eUTzkC5PeKURhJsBJJH AHI3r00I0yrjgKjNnsXJkaSae6s2O+PcX+oMZ9OA= 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.19 0210/1157] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c Date: Mon, 15 Aug 2022 19:52:46 +0200 Message-Id: <20220815180448.020889198@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 a10a417a87db..e93518763526 100644 --- a/drivers/soc/amlogic/meson-secure-pwrc.c +++ b/drivers/soc/amlogic/meson-secure-pwrc.c @@ -152,8 +152,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