Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6811615rwi; Mon, 24 Oct 2022 06:28:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hPRnsNvYqx1Znrc3dmGRjfVW8rGbRrUaafULL/2ne/PKFsAEzGh8FoF5Q+2z1tkskfnc5 X-Received: by 2002:aa7:c61a:0:b0:461:c48d:effe with SMTP id h26-20020aa7c61a000000b00461c48deffemr4870445edq.7.1666618082149; Mon, 24 Oct 2022 06:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618082; cv=none; d=google.com; s=arc-20160816; b=tFsMQQCMVtyQQ+rJsyDlN2k7O+9lK8zkTtz1XHvVgTpF8HLVdh4Z5FykWKuJ/72DG6 eMQcdJ7V7KrlmLNlT+PEZreEuiYZ/SCIyisKjvYKY90T0Jl0WqR1ClAT/K0pNYROQ5rs 03n/1d/pbAXvV8p3+B9JO+BewEHPIGS/MX7CIRp0jc5PraGkkPlKx9yndk5dowTIpbVm r97+l+jh4xouxOH0TgeH+TzWHjrE1CX/bSUdMS4N7sHZeJc+fu4FqmH6kvKCEzWkz945 OXwk172hlK2Bo8q4TdQCiwlMw2iA+dQeIBKnMwNNkDxj3+o/4UdVqClzBASMRXO5f+fx HBAA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ez14-20020a056402450e00b00461d9b36740si1729209edb.240.2022.10.24.06.27.36; Mon, 24 Oct 2022 06:28:02 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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; } -- 2.35.1