From patchwork Mon Oct 24 11:30:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8845 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432929wru; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+Sr2Xh1ZJEfUfoIEK/1VTh7tConJuQp+F9RKI2HguKug0RgBApJn3MpanjW5VhEO0sjfz X-Received: by 2002:a17:902:ce88:b0:186:b345:97c0 with SMTP id f8-20020a170902ce8800b00186b34597c0mr2225806plg.13.1666615686280; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615686; cv=none; d=google.com; s=arc-20160816; b=uakH4a1Nie6PdNtEA55/WKbWouC2KUC2t2ARuN5/cIeWUS7HoVw0X+lBJfHCvifGvb KlIlmLqkpBFx9EmCrTjpvpPNWuxAQnpFdhKnZ6GVgb/vWYK4aIeoHkl9SLvC4Fzk27up JtSjiBtTdb/PxFb5i7tRoCgk8QHuS9rjILF2ZycDDjH38m/PTlwkaOmtZwLyP3FCWz4D D8LmDCshhq+zMYuF1+72iZzn1jWRygc6JHX+Fmv+2EXzTxaQH37iGcSRN845qWFAhKZU 1l4VAwG7CMEVJuEHRv0tzPcbFra+iYkD0SM5I8Y6FRP1OYSMWuVFlN9E/QnN2OKYxg34 igbw== 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=557J+U5osaCPSamV+bNYK5PYTu0x/7nmFLhM+wi8hp0=; b=gHl/LiAyiKweFQIHOT61LoM5bFmePomVadg6XNAqHD4pj582yEAxzwr1Sy7rBF9/QJ RBOO9mLuD7fVMrdHTcdqGARGGxvtR5m4D3Ct3b7Czcb+H/lNX+NEa5mrqorgjLHWxA4p gNZhAlYSvRnX6itPAy50rUod3HHKHI0zvO/nFnhUvXzyK+wItz9yjakBle0V1IjYKXle V1/LBASNVq5YUeRk+QzSMlblQ3Vcgf4tz6ke66FZShS3rYsfRoKDjV/+gECtMMaENGG2 DzhxRo6PoGYJRE3xuiYqzvMGjtiayPBN5mYZgwpFcRp1mpVsCiXcah/bS0Bd8zpnNpV8 Q1wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NeMXGrQN; 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 j69-20020a638048000000b0046ebb32e9d4si12012338pgd.737.2022.10.24.05.47.49; Mon, 24 Oct 2022 05:48:06 -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=NeMXGrQN; 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 S232037AbiJXMij (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbiJXM25 (ORCPT ); Mon, 24 Oct 2022 08:28:57 -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 E7C7D87083; Mon, 24 Oct 2022 05:02:36 -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 7EBFFB811FC; Mon, 24 Oct 2022 11:59:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D38C3C433D6; Mon, 24 Oct 2022 11:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612759; bh=Iw5s5+UETe+i7xnW+mymxqU2oYJy+wu29Y/1V9grvvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NeMXGrQNLbri5DWF5kTEaRtcdr0onxS+qV/F+S1gir2RyPoiTOANjetfqX/vXnJyg Cb5BlGNZPZgZVPQ8AspRnCkgSTpK30xf6bDtxtLKzNj0e2alOWVEMW4FrDpltXQ7xV 69b/pLrxUh6No3vmrUGn2rU8aYGoKPugQFIErNYQ= 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.19 108/229] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:30:27 +0200 Message-Id: <20221024113002.504147137@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747573210249780191?= X-GMAIL-MSGID: =?utf-8?q?1747573210249780191?= 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 2f5ed7366eec..83a559d48f93 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; }