From patchwork Wed Oct 19 08:28:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214707wrs; Wed, 19 Oct 2022 02:13:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MbnEBQA2km/+w64Pf+ziDHB6fYIko6nnAJdegvHtikv+6C9MB3MhEBWnze5iKPAvhS4a+ X-Received: by 2002:a17:907:c18:b0:78d:8577:7c30 with SMTP id ga24-20020a1709070c1800b0078d85777c30mr5556958ejc.413.1666170813519; Wed, 19 Oct 2022 02:13:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170813; cv=none; d=google.com; s=arc-20160816; b=nAfKCmGJvNR/nnYuQt9EZXgAL8SwV/C/m2VwfMD8m6QeQpgjKDD3nFFqaXABKCXUar noOgPmBvJ0nYPPPk+BcWrg9Qm4/ZMnxlQocQaNHGWLACTBRx7GToUGKOgUN6/JVhQD4d MoZWwAe+T27S7XuaBAj+OTdwRSlWYmiO2jmtyYqe/wRLsPn0ObxA3CFNzNZSpqSwmLWw y+ggUUWxFYkm+EcIqL4yrYRiKvL4y5caU8whvkVjDXED9eAf1+QsdfzfsIywF+hPMIaT 0XA09vcROp2OJtTwknEfwX+izPFLMcUERTLoRuMSgCl6L2ZeAPSl5o1VKDWHb7VsDmg2 Ybyg== 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=6qBwUb7thyirpD9KqnPUESV5l109RMeTAv2/wp4CRD0=; b=q/7Mx/PN8wYcvFpPB7QA+ux8aEnIIud2HAL1WFJYzEkVTnO8Z8OiUYQMg5ENVhToUU 0Eg3MsOu1nwJD9RWUEFLZPu1wkkBX5XviEBGjWBktlhiY2TKTPvRjCeHzNAeWRTtJWFc ae+0VgWg+TtDBUDVOVp12Z817tKnCOuxX86qDjH9Xym9BKHwNI79NBrS8PUqadVXZydj f+H4AOf2NqAnCZUcQbdJnFPtYBxe9O3uOo9aMZP93oadThwmLSwd8n7tHeDjwt2lNgI6 Zo+tM2RECwBjAY5A7FWyuZ9pG8mg+bCnPt8Qg/CYj4mM7abW8t+kzbzmwDW0qmfiV/Ci 3nLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J7TdHC0W; 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 i5-20020a17090639c500b007824786a7easi11490204eje.724.2022.10.19.02.13.09; Wed, 19 Oct 2022 02:13:33 -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=J7TdHC0W; 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 S232754AbiJSJLE (ORCPT + 99 others); Wed, 19 Oct 2022 05:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232626AbiJSJH5 (ORCPT ); Wed, 19 Oct 2022 05:07:57 -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 097AC2C127; Wed, 19 Oct 2022 01:59:50 -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 354BB61800; Wed, 19 Oct 2022 08:58:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49CA5C433C1; Wed, 19 Oct 2022 08:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169898; bh=EDcfOZ9GiROdzrYcCV/i2Qx1Q4cPalUM4Bdj4HFS6+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J7TdHC0W+cUH7BNMadeWc3MOhtgNrgRsVvWAcIvxSCN5XMLGWOg5qgDfCtnY9+2XA 9TlmNCwZXWWgf/QUx6v1DaCllpRpg1w0dSorEWpe8G0gQ5JjTEgXEQa05tvmDOclvz kFWHRaRx8oPgKmf/vJJCbiKyAdleSw++NKGj9anc= 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 417/862] memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() Date: Wed, 19 Oct 2022 10:28:24 +0200 Message-Id: <20221019083308.384611759@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?1747106727284782950?= X-GMAIL-MSGID: =?utf-8?q?1747106727284782950?= From: Liang He [ Upstream commit 48af14fb0eaa63d9aa68f59fb0b205ec55a95636 ] We should add the of_node_put() when breaking out of for_each_child_of_node() as it will automatically increase and decrease the refcount. Fixes: 976897dd96db ("memory: Extend of_memory with LPDDR3 support") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220719085640.1210583-2-windhl@126.com Signed-off-by: Sasha Levin --- drivers/memory/of_memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c index 8e2ef4bf6b17..fcd20d85d385 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -285,6 +285,7 @@ const struct lpddr3_timings if (of_device_is_compatible(np_tim, tim_compat)) { if (of_lpddr3_do_get_timings(np_tim, &timings[i])) { devm_kfree(dev, timings); + of_node_put(np_tim); goto default_timings; } i++;