From patchwork Sat Oct 22 07:23:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097855wrr; Sat, 22 Oct 2022 01:08:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ic/oHPNlHXh6bqcNbhUfeayfcJXqH0QYdxlDZVMyEheSENZ8M5CxDB+Nfcg5DMjCw93uQ X-Received: by 2002:a17:90a:d390:b0:20d:3b10:3811 with SMTP id q16-20020a17090ad39000b0020d3b103811mr63365378pju.211.1666426137282; Sat, 22 Oct 2022 01:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426137; cv=none; d=google.com; s=arc-20160816; b=0hK1FLeY/olnXKS9W7Z9SUoCxWK0SZ0uiz2rLUJb9kHnaBzt+aGQb2MuCjuzLx6hhd 3xM5WSBqb+QiZAk9ZUNhRRbbmUMGTXr1i2i30rZOapIEARKK7+vy6oM4rqlKmjNi0yoU JwyEyIm2eqYe2g/EXbVbp36D+/7D53HaRD76S0wRCjLCclIDxrp8Pjrv+tOg3JiJYFe+ YSKiQo0Ba1e+z5Eg7H/rfTXK/pgdqcA3dk2HKYgGv3t2WTrwRrahiLDt+A+NRulglDoY fzbIP53lk041bgk7WeM95HY2Qk71ZvwoZFECH0z4HEZptc4uQpBhq8myoNgyS2ULq6Tz r4kA== 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=tP3Coq3Q6GEgYfhOOxeH1ac7RAMJepJOUaVwrmyfxiGlECEWLa5rFh3XipIBAcGt/R UkJlPNWiaUGVuCxsVlyFClK7bKBztVOrnYAqN8ZlseuLxeQITo7lkIJ126YHMav7BpgU 0NtnOLoERuKD+Mnl1kmifTPouJZyrYq4BZLDs8RP6IiNLl5NchcbzkYIQvCkqzDWKOoq 7X5fTsWvvm4bfHhR4XONNXUBgf031MZoR8CMV1GKyqYd7qcVUwLipSigPTmX0gpnG/Ki ZCgBS1z7GXFGgz8wsWeqNhvNTwpM1ty4XfcodpqYnEwqbfJmtkCEtzwe30szvRP6xPCz HM2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n1ojZjYJ; 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 k25-20020a635619000000b0043946964302si29208826pgb.173.2022.10.22.01.08.44; Sat, 22 Oct 2022 01:08:57 -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=n1ojZjYJ; 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 S233071AbiJVII2 (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233005AbiJVIEh (ORCPT ); Sat, 22 Oct 2022 04:04:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 769892C56A2; Sat, 22 Oct 2022 00:52:03 -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 5AB7860B27; Sat, 22 Oct 2022 07:49:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 705F5C433C1; Sat, 22 Oct 2022 07:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424982; bh=Vq582+ZZfZeJ50akCNDAGdJDlR6WOX/d4TZ2XfKNEBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n1ojZjYJ+WKoGRnVqkopJHz02L/p5rWgxmMEsDCJEISCgXRdZd7FV+C207mc4pNjD XaC3Mcmx83bZzBr4hfJ8EcO9L/WQkbtHdNSoY77P9RMjoFi/UOuXt2nu3Mok+ZnQsn For+ErqK6JMEkPChwWaQV+eHV4j2FiMEeO/J3wVI= 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.19 348/717] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() Date: Sat, 22 Oct 2022 09:23:47 +0200 Message-Id: <20221022072511.097903821@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374453591075619?= X-GMAIL-MSGID: =?utf-8?q?1747374453591075619?= 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;