From patchwork Wed Oct 19 08:28:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp303916wrs; Wed, 19 Oct 2022 05:42:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53iNmvGt/tnLPimFqxt1PNLpLwsCg/YTB+Ls6dG2kbR8rkglto4yuYUtzRl0yK2sjRNwE9 X-Received: by 2002:a17:902:db0b:b0:185:51cc:8113 with SMTP id m11-20020a170902db0b00b0018551cc8113mr7984333plx.64.1666183321267; Wed, 19 Oct 2022 05:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666183321; cv=none; d=google.com; s=arc-20160816; b=e/Adx6x7oOei2MjdMOBmGLbktyY+9/kl9gIfMkhdjMZmYafGFP/mvPGTeqqM7vn0ks ovLLA2Ks4m9oPdHRhhErwaU/K10wglW0jE2G2PfzRmRZreeFBKL5YYr38pJBC+QxMdJT KMD7YHbRZ2T4A+XLvR2PqgfUjykoJPy+i5AHF0hDRln61WnTEp8/Rxtd+x5exc1hd8SO OmhEzPxshDjAn/DblGFd16VTjAMyMTfsweyA/Esj5WRzcTJ8uYsbYJ6GRIcHgQBaDRK9 Sy9iiW4tCQxFS9YZ3UCTDxuOwwvS+nO0JQWZ3gJnA3XavZaSzHSg6GT2QmgHsJTzf++l FiRg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a170902ef5000b00176e05275d1si18182929plx.423.2022.10.19.05.41.48; Wed, 19 Oct 2022 05:42: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=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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747119842146546946?= X-GMAIL-MSGID: =?utf-8?q?1747119842146546946?= 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;