Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1018196rwi; Wed, 19 Oct 2022 05:54:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+OE13KktGaezaEK8XDZWUHGyYTx6uxDzhBQGi9ls4qyl+yzdlB7sR9FjdNbLvLLF9K4bC X-Received: by 2002:a17:907:3206:b0:780:a882:a9ac with SMTP id xg6-20020a170907320600b00780a882a9acmr6459515ejb.765.1666184071772; Wed, 19 Oct 2022 05:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666184071; cv=none; d=google.com; s=arc-20160816; b=xAKj7O6NrXsHtd8MXV2Z6BJT54MvJM2RVi2k6+efS5kyAuijc86ctf70tCXPJOHG0s 3iGPbO2tnAedbO0xD8Qb4NF7FghZrHwQzVLpSs6vW4jxSWevQDcRtrwPeN4NHxmc9o7g 07yak+kJjPfC5R41zGZdg+tnbWbGIeg2A6o7+sffzSAK9+63reDfeADfOWIOaC5JYas7 abz4RG5O4viTZXaLJvhfZw5G9y0xdw5BOpkEq+CNAaQAQtQy2d01jrWvNd3TdpYzxVAk jhupjU7COTJtFu+EgA42ZTbVKZHxZf3GO/lykESDZo3Kh7NGWQuOYanYaQuaF/pKubCW 1Icg== 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=bmMYGpE/OttY3f+exiH2AeqASrzonovclRl1wXdDvKw=; b=GKy3nvQGVB8FqnB5HlR+NgDSCgWzOpSehc8qApPCgXr9k1IWqxzfc5Qvjsn7knDoN1 pq6lSC9n0zyvhVqOm1SDv97LYRzAk4R3UqWptVlDqiDrA/7H8xR09ZTf82PJhnxIbfXo AsPGnHA8UPcAM+iYuQ8xu4tRhXJwASM1e46/FYoLiaJ8jDviCLXMzquX8DjGO3gdrhrP SdQ+hMRypSuHrj6CPtE/io383PZcC/WXYK/OLaM4x/WeS26K78vttbTFaw5HGnd2YkZy Xw2jVvSbFgIUm2ow/kpWvq5CHLxQQZKsRDgc5pVHO97+MlDs3gVsxLI+6Z5K/zYkyyIe fz4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XVY7cvAL; 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 sd42-20020a1709076e2a00b0078dcdbb3e87si14393780ejc.530.2022.10.19.05.54.06; Wed, 19 Oct 2022 05:54:31 -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=XVY7cvAL; 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 S232542AbiJSMhf (ORCPT + 99 others); Wed, 19 Oct 2022 08:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbiJSMhO (ORCPT ); Wed, 19 Oct 2022 08:37:14 -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 5107989828; Wed, 19 Oct 2022 05:17:41 -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 DFC31B8242B; Wed, 19 Oct 2022 08:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F361C433D6; Wed, 19 Oct 2022 08:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169892; bh=Vq582+ZZfZeJ50akCNDAGdJDlR6WOX/d4TZ2XfKNEBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVY7cvALCQEFHCTbIh7abZi8hB6y6U5v/OtIdjILuLX5s4VxRfD3itB+FRfqIDBs5 HoN0Ht+d/A/+Y2j09TIjdi9gECuM9H3UoVBMbnfCOIQvupWjpdZae9U8s0Nn3aVKin m42/TDsKj6MKcM6WH7tq94LGRuvjaLq3AST6tJLA= 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 6.0 415/862] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() Date: Wed, 19 Oct 2022 10:28:22 +0200 Message-Id: <20221019083308.294964073@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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 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 f84b98278745..d39ee7d06665 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -122,6 +122,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) } of_platform_device_create(child, NULL, &adev->dev); + of_node_put(child); return 0; -- 2.35.1