Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2886986rwb; Mon, 15 Aug 2022 13:19:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ObZ6aj40dMJJIqTkAOeKCJWxMyWdEd/wVDeA+XYDfHjghdm9Au1DLzwDYPM3gl1PkhCfL X-Received: by 2002:a05:6402:378a:b0:431:6d8d:9023 with SMTP id et10-20020a056402378a00b004316d8d9023mr16076584edb.98.1660594671037; Mon, 15 Aug 2022 13:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594671; cv=none; d=google.com; s=arc-20160816; b=K+HOJjbroWJ8tQSAHq7Pyq8ZayZagUXcgVhE6CHmbZ6OeGL2f13UDdOYlE4MCwZJoM iXY7ah93V3lUELq91UfhR3wGPXgxgyjVyYvYwcOjJFvmPN7MsEiNz9ARqF1SrjuPLjnE GfAW5vgvB/5/9keDW5rFTcVGKLk3oURLMoPf9Ksyd8eVcZp5ex056AcXX8Xvq/gzhWAs XbBp7b7bO/UFSFm+Pe1NeYjprczNbHZufbSk1pbM5HgEYNXevk3CKspAANz7IUZAqVKg Mo878fwQZinuePZomDthOZBQYcV+sr6McJMG/+y6f/6Mk+sh0TNMbVypibVXjL0Rw/4k FC4Q== 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=8vgHNHJCBf5jvHoHoG2sFmGOscuIGyAtQofn8+cHUDY=; b=bGJcMUARi0DOeivuHieqUxjPqgKb3okYrog4YbDMCxWfzUjwOwAHIdLx6N8RL0Dp+6 kjB120xig//l2q+32QJctvDpTDZ1rFtA8v3NmkrTc9vkHVJ7RnqdYrmzJGqMyASjsM+C 354s3cZIiBkxl3YT3SXjGfHgnhPG+RCoZcvVVetEbIPOUMn3an7jEYyrKgTcLr2q48S5 yETvpD+D3iV0Nc5KcuBVzIEepVTKXnB3Jxlce+7LKEdo06ViRgqvQW/8KEWjNLM0v8Hl aZAhj9ot1JFg4kpxWmLJbpXDsizHopSMk/ktY1jaj4+/xeSd+TIpqhLVKiFlmrb2Z8vI BbHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ElkqmxlX; 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 wz14-20020a170906fe4e00b007385dfb42c7si2638537ejb.565.2022.08.15.13.17.22; Mon, 15 Aug 2022 13:17:51 -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=ElkqmxlX; 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 S243414AbiHOSdL (ORCPT + 99 others); Mon, 15 Aug 2022 14:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbiHOScZ (ORCPT ); Mon, 15 Aug 2022 14:32:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1EA333A27; Mon, 15 Aug 2022 11:21:33 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B2F9360F1D; Mon, 15 Aug 2022 18:21:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD930C433C1; Mon, 15 Aug 2022 18:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587691; bh=S0URyn00AsjmOCVSf0xzz3DBx1yha/NWx8pddDfWzRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ElkqmxlXEHZZ/P0Y5szVgTBU7lH2dYoiI0NGVHDxSbNvrXNnrv/G18ESNBzLKMwhs mn5CWSuCguy1jquzXpG1Rf5T9CDAN5smFA0YiK9vpLaoc1Qbgz1NLWPESpG2jHGvia CsCIhdalkh4xrUKwr4SykaOFSvRzhlLP4CKu12NM= 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.15 165/779] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c Date: Mon, 15 Aug 2022 19:56:49 +0200 Message-Id: <20220815180344.375939543@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 59bd195fa9c9..2eeea5e1b3b7 100644 --- a/drivers/soc/amlogic/meson-secure-pwrc.c +++ b/drivers/soc/amlogic/meson-secure-pwrc.c @@ -139,8 +139,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