From patchwork Mon Oct 24 11:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457526wru; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QRPXPvqizziZS+iuRy3Diq4TrQq3lWj6abWx5ZnxjhQEwjQrmC/f1ndVZlmc/Pc83PXEL X-Received: by 2002:a17:90b:3e83:b0:212:de17:952c with SMTP id rj3-20020a17090b3e8300b00212de17952cmr15184567pjb.102.1666618568698; Mon, 24 Oct 2022 06:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618568; cv=none; d=google.com; s=arc-20160816; b=JSdF9cHkUOal9/C3A7/BqR1EovS+5GYgz19Pwf5ezXfqwwjfu7lnMDVd76x9Ii3mFT TuLuxONHBJJiFVl8ZKgnnJ1xRXv91WE1qnvtycySUYGlXC7ewB50ZXwSQfAIL3ENHCot di4uf5XSHc2JD9ya+g4Up3OVr6TMbmSVlzDzJeB3zi/h6kRAE/IIwko086MedK5xAIL+ u7NUuP+oSA4KCPtNxV4tC6xqrCizeXAEzAHN0PqxtX26LN4Ng8uPyreYlyDHxmJRatWb xiUUQxKsTPAgW/i/8MMcgCBJUKg5E3DObH7eXnPi6GbEvNi4HlRoa0/3vJVo1ogCfA/R WkIA== 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=41Y6EdhkH8V7rf9AfmNpUAgoyZcnGmOch8y50OHZNes=; b=KPuE8mlxbDRkMDGnW4N4Il69zJKqIQTqSAvB8/d7h9MYzgksC1bdzIjaqz2KEqitCP TK+/WuTocJAluyuWZGVhJTGGFaYItoTF1KM+NSEs2N/lnBYoRPCGfpEtuxRWiE99EXCt 8GnFNJZQcVZJFY64YBXfCEGPLpJpJEUcSLw009opYtiTCMV6xXMV1u3wcreKOIvpTPVj QKmupK/pppyZ24sBNqQ+d60hwd2+R8JqwfZtD1E1rCE4e7/yggU3F5patD5BjWnLnw9b dz8+E1qJTemKplcU0rf+RcTocHcygXJdYzc1XlXHmQ0oxVduKxGhid2D79YgAcuECdy1 5loA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kvnnf8PN; 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 v20-20020a170902f0d400b00186a98b58d8si2945212pla.134.2022.10.24.06.35.41; Mon, 24 Oct 2022 06:36:08 -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=Kvnnf8PN; 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 S235706AbiJXNNt (ORCPT + 99 others); Mon, 24 Oct 2022 09:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235697AbiJXNMX (ORCPT ); Mon, 24 Oct 2022 09:12:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EA2F11C2A; Mon, 24 Oct 2022 05:24:37 -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 2DD79611B0; Mon, 24 Oct 2022 12:23:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FA54C433D6; Mon, 24 Oct 2022 12:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614205; bh=nggt5QNHZ4QL3rbqvTQdzEH1qGPeqU7CytS2iNQBeXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kvnnf8PN2Cu8GKJTWUiy3eKrlipIXBXHU/olsbl56go+CFP6An5hOnPFAD40Q+cpS LsOwfTffoqJgQxsiCSquEZjNk6MrwF09P3gLlxMSJAM0yTXfeLPqY1KKjITSbO0PKT BkmusSrkIZ6BSX4HLt3pGqeOzw86ziF5lSx/IVcA= 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.10 172/390] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:29:29 +0200 Message-Id: <20221024113030.034732557@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747576232083022905?= X-GMAIL-MSGID: =?utf-8?q?1747576232083022905?= 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 d9f5437d3bce..d0a80aefdea8 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; }