Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1168853rwi; Wed, 19 Oct 2022 07:28:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM758ToQMZhtEhLdnBBR2dXNY83hl2HXMIqncS0T04jUXbc2Wd3dTIPgq7A8I5XwBkmW88Oo X-Received: by 2002:a17:906:8451:b0:78d:d467:55a4 with SMTP id e17-20020a170906845100b0078dd46755a4mr6940680ejy.352.1666189706216; Wed, 19 Oct 2022 07:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666189706; cv=none; d=google.com; s=arc-20160816; b=dZ/BRMeS69jv+mgbgZ+R8AZE7UbIcqjeFw5M6Snxj8z4EhTAk5gJifiaMO3Oor9IWd cNPo2zBXs1I0BLpgQAXFj4r7giodwgBZL3uQUn9+yvU0uPJ1/hWno4qF7TBoBe95F3NV h3muLb5Oqvvkui9oWZ1iy8xV/HIt8Glc5zrmQOvgfZU9xkAU0hpOLfYx7QsZKC/rtgqp gNVUuphYHJ1DZO1kJD8o1netu9wMpjqKj0xKbaRVggjlIyoEptxp8Xm2tvhF6zLWQL1a XegoqdMhirbiDnBn+51I0gnjyJx1IGtutCJnWwu1vI0h2fJ7x5c7ghA22ivsCNaL83ur V6eg== 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=/xAzDuWRkkCz2MxtJs9KWWASaDi6g7o7uywWNFAWqGs=; b=u1K0hDlj6NoV3x6eOTw1PVkDnu78o6DY0iktqZQ70FAKzH2iTaIuxstM7GtJ4I+mQB tspjECPX4/HzldKEd//rHQaPwFC1Pl8fsMQWXQ3NxSxGNbV1R2LeMFNj27NQ+GuRD7ov XstI7JpNJZUe/Bkd/EH5v+GY+8Ff1JIFo2n2+zZP0Worq2vk0ycYyG3LIktlQiW/p0IQ 2kjEVqNnjpFTDNi+q9+yCnCqipIKgYPWkdhmc/pV1gtwzFZuQL0YUJpSw8tcmlj5Ug4a cSFbMm3e95xkGKbMx4o3EYTII5L68sdF4zJzhDYLuYcFClDCOtsI9Tg2rfAcSujXTUiq 6dKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EBJT0Xse; 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 c15-20020a05640227cf00b0045eec876883si3536820ede.229.2022.10.19.07.27.52; Wed, 19 Oct 2022 07:28:26 -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=EBJT0Xse; 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 S233488AbiJSNrQ (ORCPT + 99 others); Wed, 19 Oct 2022 09:47:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233255AbiJSNqH (ORCPT ); Wed, 19 Oct 2022 09:46:07 -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 CF68417252E; Wed, 19 Oct 2022 06:32:15 -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 29861B82426; Wed, 19 Oct 2022 08:58:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 209A6C433C1; Wed, 19 Oct 2022 08:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169895; bh=VDRe/5Hbi95puk/YwoQKy5coXP8NgEp+rB9ALswaBwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EBJT0Xse5jFX3YpfBDtthT07Gf53DyLmZAwH9QKx/GsRxmvqs++/HFIa16ZRFY6U2 BO0DAs0ZHS0dG6k2ibTpIuATRlipyQ1M7qCpqnojtqdyndPpvpCw+cTLHUfix6sc77 P9uAL10Kzs0G7rbW0q6F0n9zON3nvrMYuNXmgQ2g= 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 416/862] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Wed, 19 Oct 2022 10:28:23 +0200 Message-Id: <20221019083308.335779787@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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 dbdf87bc0b78..8e2ef4bf6b17 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -134,6 +134,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