From patchwork Sat Oct 22 07:23:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105139wrr; Sat, 22 Oct 2022 01:34:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yaBo15TrH2x9atHmctAxc/KZMWU+aUOze4+n5H0mIQRgdyfzUlvhsXdK/hZMRwrP0BcUh X-Received: by 2002:a17:902:c410:b0:17f:8d9b:7e68 with SMTP id k16-20020a170902c41000b0017f8d9b7e68mr24062686plk.133.1666427653001; Sat, 22 Oct 2022 01:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427652; cv=none; d=google.com; s=arc-20160816; b=qW3Dam95ykl/xddubEwsuNuESyfp2PGBsn3QjtWGR73zQ4T/97RhsJKMbQuADlb0PD nQi+RSX8hOF20pjB0Iv8M3YeCW+zuE21Otn3J5YnMQZQQh+oMeBFCla/UCGErQbWYhc4 VqiIehEKOOgKmdy6xhzp45yJvrZk7kz0VmJj61BBibB1fTyWucFVKEIZ/DfRCfkbbcdW Nsl+DKCmL6QXVRJtpnhAOxhxEEcqxNj1xWv9cwr8WPaOVp/EgATNHZKPhcqmXBBDZ8Ri UfqyDGhZpV9AJzN+vzs685gOkH/zjSsHhb1lAe9jgJnR++uQdTEzqD9UFVCX3LHqx9Ri nLaQ== 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=qlYtxZIoA7r/14O4X97FxmLelxuhA1ihXeYKqpIRLZ9mV7vgWoW4xMtKLKS+NB0Wh6 HkM+0sbUbHmWJdBETQokiVouV0j8oaWhKRhXQBj/DWjPx4xHczMaRSTCpIkhFjsZkCye BCQJixrorMjVyo5vxsGOWa+EjEoq7jqBw5ezEnBNYrh6p6ciL72gs/QLXzUVIBrQ0ole CBPWj35ME0GhjOW9PiVBJu3m3k+xxvo23UtmWuimqJ7bkn7kjtP5xJ7Jkz94Ribyurmz m0pCKqpI1DRfn7Si2jfsD5DyQ783sRlRyYIVUbnqU1CtjTSZ5XhOWhe02pVTjJOvWOiY Z8eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=geNApx98; 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 pj4-20020a17090b4f4400b001fe1cc52234si9679833pjb.67.2022.10.22.01.33.55; Sat, 22 Oct 2022 01:34:12 -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=geNApx98; 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 S233809AbiJVIVQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233797AbiJVITo (ORCPT ); Sat, 22 Oct 2022 04:19:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07FD22DE461; Sat, 22 Oct 2022 00:58:05 -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 B0F79B82DEF; Sat, 22 Oct 2022 07:49:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D37BC433D6; Sat, 22 Oct 2022 07:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424985; bh=VDRe/5Hbi95puk/YwoQKy5coXP8NgEp+rB9ALswaBwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=geNApx98+8y52WChecnzNJ5W1XFPnKSNGY251SlLxqIHF33FvizogYOF3LD4qOHLK MLRCQwLH2U4RR7pEDrK6zlGqgY6IIfEBafDwHL+unctAq5RWMbViq+4aTgbLw6cAGb u45alUgL1TBZUSUkvWg9/etvAHiZ7vzwPuNYAkDk= 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 349/717] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Sat, 22 Oct 2022 09:23:48 +0200 Message-Id: <20221022072511.162072362@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?1747376042680049664?= X-GMAIL-MSGID: =?utf-8?q?1747376042680049664?= 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; }