From patchwork Mon Oct 24 11:30:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420279wru; Mon, 24 Oct 2022 05:17:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5o7ZhvTdnG+EVAzk9ES8CXSM8MB5m8PYMswpyCZzSLYt57Z+Exv1Wh6rCNDy50eZYpV/Sx X-Received: by 2002:a17:907:2cd9:b0:78d:9e76:be26 with SMTP id hg25-20020a1709072cd900b0078d9e76be26mr26691426ejc.315.1666613874449; Mon, 24 Oct 2022 05:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613874; cv=none; d=google.com; s=arc-20160816; b=WKwrdtoSSOOa4RISMOfITClGVOBHx42DFUwy96x+0e1FjTkLN0kMzv49J+nn2aqMSK LA/+TCUhyEZ+vYOxfvOIUzkJgEIAOFVdvBs2tgN3jMVD+vgmvZ4CwhKBhwtK/2mHzVTt fGczfEiNKT9DZ3NPA7QE9z+rekgx6R8b/pehKG5X6UNco1WY2+oLGh4BqnqdyAIz+6bR EjwT0Cah+0W7XIDS0M7bZJbPMw13ajcfq5iA1TdXD7DDCd0q8zuquBKD9cRMu1yc+EcQ LAahK1SJD2hFYXBbKmJQRVG82GMe3AmuQHU8qDfrnYQTbfY9m+lecYXZUPQ7g3y6/1mE FReQ== 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=UsLAapROTjcpFyKP+n25hzfibwA/40UUxlNrafTaqkI=; b=LrrhYeHgdzM+qnHwnlREt8D1EHhIZPFRHWSDYUPBEWNr1ZKvOm8r4OYpS1R5coOg5w T1JaeNBYyHaEOwU+WzzyfntghrTFkmP/DJ1oB8Cyc5BH7Nco4LZs2Zh3Nu9QYyPGj2Yv +IkGgeIFwJW6IzjtUeZW2k/QWY15rvU61po3E6PrDSLCvhSz59nuP4CZNnDt4D2DSZPk sWB4XEOmXD6su5rn2gfjkiBSyvImrv2Hxdv02F2MB1Y1A01WZ/RF954itBHqgeqB8ver Ic8lXP88ke3M3SP/H8CxxL89xoahR5HOsU1caDHQVQEPZCd1jDqVaJuxOcyNILvMw6oT +yag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N4g1N5QM; 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 nd33-20020a17090762a100b0077ac5f39842si32151470ejc.96.2022.10.24.05.17.30; Mon, 24 Oct 2022 05:17:54 -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=N4g1N5QM; 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 S229766AbiJXMKz (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233045AbiJXMJ2 (ORCPT ); Mon, 24 Oct 2022 08:09:28 -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 2AA8E2618; Mon, 24 Oct 2022 04:52:38 -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 6F11BB81190; Mon, 24 Oct 2022 11:51:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD835C433D6; Mon, 24 Oct 2022 11:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612279; bh=EEFNLSb8iNcOZyiCRkJW9dNUJ383IzbjdI0YY57GVjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N4g1N5QMsT0AoD7bZmRr6Cu7rVPLRfBrKljr5LdHhYuAXf9ARYYe1xR6A0A/cYzkg Qnj2N7PROoOuXGLtdpiOSiFmRknHYFq1zuXWLveR5elm0pqX/ZQ45xCJev3NgIs/la PkhjpedwP7tx27tY4+n61gE4soBDrc28tEd+gY2A= 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 4.14 106/210] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:30:23 +0200 Message-Id: <20221024113000.455445590@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747571309806817495?= X-GMAIL-MSGID: =?utf-8?q?1747571309806817495?= From: Liang He [ Upstream commit 05215fb32010d4afb68fbdbb4d237df6e2d4567b ] 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: e6b42eb6a66c ("memory: emif: add device tree support to emif driver") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220719085640.1210583-1-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 568f05ed961a..36517b7d093e 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -135,6 +135,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr, for_each_child_of_node(np_ddr, np_tim) { if (of_device_is_compatible(np_tim, tim_compat)) { if (of_do_get_timings(np_tim, &timings[i])) { + of_node_put(np_tim); devm_kfree(dev, timings); goto default_timings; }