Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2925939rwb; Mon, 15 Aug 2022 14:11:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR5L6mwNnWLg+dxTs8vYMMhwZCztgEx8nZ7ValGFa9YFPH2Np97a3j1Y11RPvGtFgCbKv3t0 X-Received: by 2002:a17:906:8501:b0:711:bf65:2a47 with SMTP id i1-20020a170906850100b00711bf652a47mr11745106ejx.150.1660597861894; Mon, 15 Aug 2022 14:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597861; cv=none; d=google.com; s=arc-20160816; b=tM6nSa1+V/HOiu8sLPBEiAq30Ktf5BhIpZT5OkC6bzX27b04lFheNBJNl0JKa0/SK9 LNdRK6Izy1f5b0G1gZqUx98dMogdzx9omkCrTIS7YWQOL+nlPRhX8op1rWn8xhnoh1R6 G0ZpYG35HQmwe1CKJzZZtJ6E2xxXfZQwDYkaoGFGrdhnENJCDeSVERTFxtQEnW8fogoV elzK4odeA/SVHbMfIzQp1A+Xz9ReAAB9vlaKoXMSsbDI16BS+YhyWulHvr6UFxOnMozl 1NThp3CvTIwu1D2+CXsyXituQKB1TdKYyQCcaH6B/m3vhYAAbpeTREXDUfhDYfLKBzqF 8bPQ== 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=RVv2XFBcZ0T0ALiw9S1L/orc0/UCurtrHgBcp4G3UI5xQj6MkJhFAde8IpDur5CCIb lYzssmkbCHrp+Iw5xMc14H9DFKrbt655pkbd1H5IUfoB+I1jrSd68EzimC2akLfDpNbb 7kIVvp0EiABm60O6R/xAPJTtPNmYGJES34PtQ1qVmvPeh8+MnSQu9fMEMOCOucmgqVoj 7N/uXBT9ifNNyAdF6qNrcGkscABu2ykrovKEoA3ok81XjYD4hzoIh8IWaAKBbMv3bDfs LdJzU90wHT5rjz6qrAJX5VbSb/BlIzou+89VxJUxELAoQ7ZH0pbZJcUw7qtOv5VEnlUo wp+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ej5Zd1KC; 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 f27-20020a170906049b00b007311b7d141dsi8126038eja.595.2022.08.15.14.10.36; Mon, 15 Aug 2022 14:11:01 -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=ej5Zd1KC; 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 S1345234AbiHOUit (ORCPT + 99 others); Mon, 15 Aug 2022 16:38:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345848AbiHOUeL (ORCPT ); Mon, 15 Aug 2022 16:34:11 -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 E6DBD4E608; Mon, 15 Aug 2022 12:06:02 -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 8F2E9B81104; Mon, 15 Aug 2022 19:06:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D00FBC433D6; Mon, 15 Aug 2022 19:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590360; bh=ROhcCfIKrzYI/OpUhfYzvakQSe0wUMT4P7K7njz8oqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ej5Zd1KCR2wofxg4dsAsMBEbPEdcWuYIa2muirWpxeowQYc6/TSY9Z3bvHlVuJrSo Q9dnN1RyoARgarOY4zNKwHMn5EXvopgXe6kckN1BLi20+oqoAheNeQW2+6GvnFku61 onFucHGOFAYB3oPOLH64C6jahu+78ReT0L1kso3g= 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.18 0195/1095] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c Date: Mon, 15 Aug 2022 19:53:14 +0200 Message-Id: <20220815180437.699287177@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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