From patchwork Mon Oct 24 11:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9100 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456038wru; Mon, 24 Oct 2022 06:33:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM762v6ja8CRDXdZlxakzmrJbG1XWePmekhqb1u35ESITvDqX3CdUzkte1wHk5d0jJbC57m0 X-Received: by 2002:a05:6402:35cc:b0:45d:4a39:2a43 with SMTP id z12-20020a05640235cc00b0045d4a392a43mr31039159edc.304.1666618406310; Mon, 24 Oct 2022 06:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618406; cv=none; d=google.com; s=arc-20160816; b=r339jZlynl0bnubnoZMM61JrwLqkwu5D8JygwqfGAkGVZnIln6MD5oWp9SR04b8CiG fPFSrMFuzXXJw5sFTIdOnNJ7cMskRJY83d6aozOIhvswkOJLuNTbpLTlnPQ7cd2AoJO3 JLzFHUtBJ4Hyr3oC8sclvIWs0YA6LyumMrocSqst2+9c2dyYWOI/NKZyqvZ9pKo9hRQY +5n4zs7jkQU78tDenzTpqr171NfrgBJfmhDYxClvcNXr4+PEHqFaUSRDEOb0g57ENFp5 f1gS0BMjNFnXLo1kwSydQ3vI6/WfiSHzTY+e3QJtJa1g07fLrkd7hcmRgmi15kyax+QV 4awg== 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=9wnvCFcEnXfxS/Ww8opicu5NtSeKcQpHL12SMGgvldg=; b=E77AzJbxdFClQPa7AGHVF/3flpgr0Vnvab6ihRcRLixttZdTl6pkRA97lQdN3Tckhf egZqZdShDUhHAnu9USDu6K6QGjELIajGSJQs9IpkPp9NZA++zDNi30DyHJ3tupUyjpNB ymA9Dc4fVQdZMCk18WZyNVpo6aU6Al0BEqQZyuGNg9cV70HmTHzwZlAAVHZ+H5pn7VGA rzDYYQIYeexBh7gXYVm64VUnvmgicENy8WTKb1fiP7g1pavB1GmmTrJD5JzcR1Ij0yGQ k+0nZyyNhaTAHzG3+3E6MwsvIuKII2lsxqA5MBOJsro9nb1+e5NNcS2Uul2JhtZ2X/lf hOPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XXu7WwR6; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw5-20020a1709066a0500b00787aba35b7asi26344942ejc.102.2022.10.24.06.32.59; Mon, 24 Oct 2022 06:33:26 -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=XXu7WwR6; 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 S235834AbiJXNNw (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235720AbiJXNM3 (ORCPT ); Mon, 24 Oct 2022 09:12:29 -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 7E94C11C26; Mon, 24 Oct 2022 05:24:37 -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 94942612A1; Mon, 24 Oct 2022 12:23:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A07AAC433C1; Mon, 24 Oct 2022 12:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614203; bh=/trz6K8V8Y183basi795y1i/HvhwO6Kujiip5x0dDp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XXu7WwR63TmnFiuBmoiq+aMGU3TdHio9w4mBP7Cu67BHpakZfTjPDodhNtGtS1NLS a7nlG16JAqz4Bl1MjrunbmD8XOBi/0LIwoHrLyLLaKb+ujRvs4HFUzgTixiUvhCv4u RS9XPpXoABwgvb9hqXSS4AMIXhkuxHwH5V3dCCSY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.10 171/390] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() Date: Mon, 24 Oct 2022 13:29:28 +0200 Message-Id: <20221024113029.994815067@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576062093755878?= X-GMAIL-MSGID: =?utf-8?q?1747576062093755878?= From: Liang He [ Upstream commit 61b3c876c1cbdb1efd1f52a1f348580e6e14efb6 ] The break of for_each_available_child_of_node() needs a corresponding of_node_put() when the reference 'child' is not used anymore. Here we do not need to call of_node_put() in fail path as '!match' means no break. While the of_platform_device_create() will created a new reference by 'child' but it has considered the refcounting. Fixes: fee10bd22678 ("memory: pl353: Add driver for arm pl353 static memory controller") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220716031324.447680-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/memory/pl353-smc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c index b0b251bb207f..1a6964f1ba6a 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -416,6 +416,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) if (init) init(adev, child); of_platform_device_create(child, NULL, &adev->dev); + of_node_put(child); return 0;