From patchwork Mon Oct 24 11:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp463259wru; Mon, 24 Oct 2022 06:47:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xkJ3xEZmN1TsqE2D8FEDUVNWeEvGRWsxVYJhoHq/FemV87B2XbvIqzSeU3LI4wgvjdUC3 X-Received: by 2002:a05:6402:d06:b0:45a:3ac6:ad26 with SMTP id eb6-20020a0564020d0600b0045a3ac6ad26mr31108126edb.195.1666619249707; Mon, 24 Oct 2022 06:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619249; cv=none; d=google.com; s=arc-20160816; b=qR+JPriWrnZ1lgTE8cD6CtQDRoSj1yZg7Kn0BTcZuYWku3HlmYIM9lBWZgvxi8aEhL p/I6DP/d6/yK2U+TIW+LUVXGOWl3J1Iv6u5I1gG8B0QvjSJZ77FKN3IBv+Xs3f5rP3Oc a0RMiMBWpghwN744lURBUXwERXSqAbAP2gDYlu2MX5YD7fAKr0APZB3n34Q2Fr8l+vmo x3SKbNSEC79XZlgiTYGCTj2mPtpzDwciQjLxrUY131SeokNKovmixmq3jos3a+tLX1eV MfJ/qBwhTRlUCkYf31D1bcldO6qxutCKHwUfNYs5d/Dmu+KvZk8g8aGGcMzFImPQwPb9 RNow== 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=/4n7HZjbFgZDgQTf2QXX5TYweo94YCwGyMrBy/uDx0s=; b=rGs8KlOMsEKUJGUnf9Fc0xhmOTG5XUnXo8j2aCkqUcyqq1ElQqoWSpqqzPi0n1sbG2 +Tytqm5TcMwmA5pzfU9xZ7amRe4FCvwN/byev2tDz10xSSm7ZAwVmxF9s/34+9HuUaJ7 /htSTNovJd38iDASiHaWGnmGaONHmliPXzgJKL4BbxJ/dHUkVaPwwoDuowY8J9+aZwdN UHnMtHTfNBZ4vBKWZQ84+a7Hd8zukPgd+EybXJ5VCk4pAdaM6qQHk+SuSXpnDUaatn9a TDmugVv7St5QEqmNIuEQHLie960/k2hUwSdJkZ5MDJpOKmNy+1CCYndALlLo99B7xGXy FXuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ONAPVpSh; 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 qk10-20020a1709077f8a00b0078d112eaf80si29649511ejc.86.2022.10.24.06.47.04; Mon, 24 Oct 2022 06:47:29 -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=ONAPVpSh; 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 S236175AbiJXNpY (ORCPT + 99 others); Mon, 24 Oct 2022 09:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237016AbiJXNlz (ORCPT ); Mon, 24 Oct 2022 09:41:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ACAC6167; Mon, 24 Oct 2022 05:39:32 -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 C3AA0612CD; Mon, 24 Oct 2022 12:23:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4B6DC433C1; Mon, 24 Oct 2022 12:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614208; bh=ImaiAK7jHhbV8YcUYAVGJfAjkWTkK3o5h2uJ0SiwaWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONAPVpSh+izPYllsZdvE3G74Et3juO36OQ9jvROj8dcZwYVDUGoRjob124gByEKBs dp23OVfdyrZeMWHP5FfGOGO1e7hDqXsEnxHIiv2J8edXvhJiIRwOPJDknLFFVel4ms qEvWfvv4DV9OMFEu+3osv59zbjoNiEo0DBdf1xGA= 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 173/390] memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() Date: Mon, 24 Oct 2022 13:29:30 +0200 Message-Id: <20221024113030.073561904@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?1747576946554115240?= X-GMAIL-MSGID: =?utf-8?q?1747576946554115240?= 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 d0a80aefdea8..1791614f324b 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -283,6 +283,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++;