From patchwork Sat Oct 22 07:23:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097102wrr; Sat, 22 Oct 2022 01:06:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fDTD/FvecYOcEUV+SCTs1WiSlhjS8/hX0q87IgPLWeDdHSJKrntl3DbfqI3JCS0YGF6nq X-Received: by 2002:a05:6a00:16c4:b0:535:890:d4a with SMTP id l4-20020a056a0016c400b0053508900d4amr23463824pfc.0.1666426008385; Sat, 22 Oct 2022 01:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426008; cv=none; d=google.com; s=arc-20160816; b=GmN8/LbHTf0bWOqU/MaBE/hE5YMc5GEOozyGjyg2O0mw/90Hj8chlZk7qmoqCiCkH2 hED7zTPosnTN3pHw+2iOpWCgw2LDAwzNPu/L/oykaAE5Y+ZA81MNDGKKR6fIfbR5uN/d FqwHWiVG/k3qYxTvWDa5h9FGQv58FdTbEYRnsD7FlTFxD8tuvZy8yMVPI/+58+Ehj5Kb lGLB0QNYBLgvrE5+GNkNXqm72QFweXFFtF5noDmk8xl0Hba97iIXB43Ot7IPD3mGikYX SAhf8Dkmfc/shLACXmNwOXYU+tNugwwnXB3gddNbxCulHpgG8VfPd7kiAkJCNmM2zdF/ xVtw== 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=6qBwUb7thyirpD9KqnPUESV5l109RMeTAv2/wp4CRD0=; b=DDOj0esqeOHb+2MQq+X3MlDdB10DcRufxWhHCtVjsOIJLUtyijaeKCdlFgB/NWV+lG dlusKxCiQUCYElIOB55BsF9FVG/5zL7iFFcneiZm6avoixqU5iTxaUxx+tV7A3hDW87E X7H6q7qPcsA+eTUAD9n6aapKkOLZEhFVGOLzf64lybXhkBvubwC0HBfNekRSA+ZfVBgc kXwvMTPuTynSNlpF9AKTHYtdLv1TNkyRLjy9w0uCDlKk6lgEGQ0RgArCu5Mjce5me45+ r4L0L+S+XEA9Kh4CVW1aC9/yjoAxDJeQw1XU6GeMZzsHEN0vNci3wygtXE0FL8U/L9rp 9/Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XTie77Rx; 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 h185-20020a6383c2000000b00460fbf095b6si25947997pge.562.2022.10.22.01.06.34; Sat, 22 Oct 2022 01:06:48 -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=XTie77Rx; 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 S232702AbiJVIGM (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232738AbiJVH7q (ORCPT ); Sat, 22 Oct 2022 03:59:46 -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 8F0DE72975; Sat, 22 Oct 2022 00:49:49 -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 61C2DB82DF6; Sat, 22 Oct 2022 07:49:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6F0FC433D7; Sat, 22 Oct 2022 07:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424988; bh=EDcfOZ9GiROdzrYcCV/i2Qx1Q4cPalUM4Bdj4HFS6+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTie77RxBdAB48J9HR9mrbCedZbWfA1OfbgSP4E1Ra4bTt990L8rfucwz3pPYKYC+ kjfYldXgBhsV3R3bp4b+PGt5y/voKT7e89mBWG15faUrysw02OFpxJciDak6IlBS38 fY8U55JAwNBdz3IRo3HVtn/5SZS/aQFSxgDFYoxc= 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 350/717] memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() Date: Sat, 22 Oct 2022 09:23:49 +0200 Message-Id: <20221022072511.220388639@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?1747374318110572094?= X-GMAIL-MSGID: =?utf-8?q?1747374318110572094?= From: Liang He [ Upstream commit 48af14fb0eaa63d9aa68f59fb0b205ec55a95636 ] 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: 976897dd96db ("memory: Extend of_memory with LPDDR3 support") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220719085640.1210583-2-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 8e2ef4bf6b17..fcd20d85d385 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -285,6 +285,7 @@ const struct lpddr3_timings if (of_device_is_compatible(np_tim, tim_compat)) { if (of_lpddr3_do_get_timings(np_tim, &timings[i])) { devm_kfree(dev, timings); + of_node_put(np_tim); goto default_timings; } i++;