From patchwork Mon Oct 24 11:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434217wru; Mon, 24 Oct 2022 05:51:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5co/4DnfisnftK148wBXSZgBEd7cIr7UTQh1h1ZK8L6R9zFFiogTNx5lbJDPwu003Qks2E X-Received: by 2002:a17:907:a425:b0:78d:b3ce:1e43 with SMTP id sg37-20020a170907a42500b0078db3ce1e43mr27059860ejc.95.1666615901634; Mon, 24 Oct 2022 05:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615901; cv=none; d=google.com; s=arc-20160816; b=GfAbUdp8k6UDhtVepHOWkXYe5pD2k6YL3nJcnJuHlioPidway8vam0wsDZlhCXwmRp HLnqoCNGUPlQbWHkWLV/upQ/t6weHZrkWD81OxMhl7qjsnGQ5nFPhAyV7Iu4ts6LbwAH kD7td9QX3ioID32mX+VjKspUvva9ln09hg9LSKxqI73Eb3/3RfcWVLGeJN27STDiqWWz VAJjuE0e5rkwhCv9BDypoo9EjIKfs//IWqtE24tYENmp/dszAEzBMwWz302gY8FyZ4c3 MuoGDYP+gh7w3/Sh0vpO/fXwhN8KEAaQ4vKd1h4T/0/2e1emKbqJGYdsHdvCj1hmwQFb 7Hsw== 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=w9QJsvoBV1DXMzRnbFQip0hXgSOXCUDtag1s0npJAn/iiR8pNztvBpbblvKCq3nNAW 3sFsnM55eB2TdhNSHZ9A6zlmrk5Py7GAOkG/CahXGrmFtQEvDVLYxyRJlwpHYXepc5bA aGSfDkFvQKeVlHti2KDos4laFZyMdwR0ftuIWM83UosyNTmfSRVlpzpQR8omgiO4/cDB /nRQEDn2R8MnoWaosnzOw6O7vJQnRZoDThOxjIYY0J/mpVEsjdifPuURiWId9MHTwiYu /0OZhldmilpgNWqkgTAuh2B+fuusoijQD/xsN1/TinLqmUNMXRgmHHNpIm/LDtWVZYJv WNow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P7bp++73; 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 q25-20020a056402249900b00460f0c0c565si11917367eda.197.2022.10.24.05.51.08; Mon, 24 Oct 2022 05:51:41 -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=P7bp++73; 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 S234616AbiJXMtK (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234403AbiJXMop (ORCPT ); Mon, 24 Oct 2022 08:44:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E15958D0F6; Mon, 24 Oct 2022 05:09:18 -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 36795612A3; Mon, 24 Oct 2022 11:42:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CF59C433D6; Mon, 24 Oct 2022 11:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611757; bh=EEFNLSb8iNcOZyiCRkJW9dNUJ383IzbjdI0YY57GVjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P7bp++73voKOFI7GKENBJwVlGUDzdTpBv1McVWEUAGQSW6ZLkkxeJxMiw8ZCTIQQ2 Isxp2+pwlqhOzFEcHywZvz4Z+1awPiJZ9fCSjSSD1YdI1qSPuAIl87nkppWXlNWjVh dxuIqOa8cH3VlLb3Hwg7MXopkDmLFbFWy4BgQ+7Q= 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.9 082/159] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:30:36 +0200 Message-Id: <20221024112952.419317221@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747573435216609071?= X-GMAIL-MSGID: =?utf-8?q?1747573435216609071?= 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; }