Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3414087rwa; Tue, 23 Aug 2022 04:30:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR54BA5u/JsNglRC2MFNkakiP2kBx4mjGFltjqDH/ruvDATFJKGFqmjaUsskubUrn2K51/z+ X-Received: by 2002:a05:6402:538a:b0:43a:298e:bc2b with SMTP id ew10-20020a056402538a00b0043a298ebc2bmr3216204edb.125.1661254217956; Tue, 23 Aug 2022 04:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254217; cv=none; d=google.com; s=arc-20160816; b=0qzZunT1Wi14MiN3wg5TlYqlsLE4baK8bU9xPwVBEPRGE6B+/eWA+A3OfFxhoswZr6 tWGEyoNsiALTR5O9cjLnYZBjb8OEpMoEEyWjxjmL/yGVXd0tbCKRDi0u4lZkdl5gRED7 k5vDcw3EFKqiyvE72C44N7C1Hg2PWr2gHxvjVWj+KStSYjCjtytBd/SF9FJRSGiUTGYn n/zwDvE4bkdKQ//yF7tr/BO/bTMOZCRMQBocL0E6zaN2Kuj30pjGOENeAh1kQAZCrdNP ZqSQ3xuHIsRHwWNg2tjoQR5RCYOYgZwZUAIvctn8uk6Ba0pbo2dKmYhTUEyePr2Ya1We Gkug== 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=FQzjXsQSpqMMqAfYKECl3+Gp4kzZdfSOYmkCq5nLkwU=; b=FPldwvuuFQWQwudvHCHOM/KSNy4Pom/5XYGpaCK6PeH7KYkfQtQdTFqFswS2QAkYJZ v2crDsQSv9YCqyzako/A+Gy8xfVWWDagx2m+L7p4yxMW4lra6aB95bjj5plYTgsPFtj5 TNbUGwD5jz9G4sKWZVjwj+BRH5bE+IvTQJeHsQQE3tKnpt17PD75ls7x+q4/ZMEqFPtg 4PL0IQEwMMCsUISLTqXTXrY6Z0s2dgEIqSNcPpDCKTyaJf/HCfio+gcMwXgfGM9bWSq/ 7AiyJntx0x/ZKGSa9gxkivrhoVeAEt5JwmSqrV9WLG947jrJs2leMJSasgPayV0KEk8k rj2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oAtlR7Wl; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a50c342000000b0044260de35ebsi1625721edb.214.2022.08.23.04.29.51; Tue, 23 Aug 2022 04:30:17 -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=oAtlR7Wl; 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 S1356172AbiHWKlf (ORCPT + 99 others); Tue, 23 Aug 2022 06:41:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353714AbiHWK1K (ORCPT ); Tue, 23 Aug 2022 06:27:10 -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 63EEF844DF; Tue, 23 Aug 2022 02:05:57 -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 A94D9B81C66; Tue, 23 Aug 2022 09:05:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3971C433C1; Tue, 23 Aug 2022 09:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245554; bh=iwlSgC6Aa0nWy47+NA8m36MZZmWgMbKUT66h/Y2MjP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oAtlR7WligDj25Q3T0/ovdHxseIgAf8QzNScJn1OlXgGxCucTJbuD97/U03T3Q5gA m7pJlA8v79ODDPE2+BfO0XL/O5VG4Y6DFj7eO460TdW05JlSID9yFlTiWjSZp4gG4M u9GZfpwnqDs/JpbNc336Du0daZ4GNWqLApkvjjYc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 4.19 115/287] mtd: maps: Fix refcount leak in ap_flash_init Date: Tue, 23 Aug 2022 10:24:44 +0200 Message-Id: <20220823080104.248130751@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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 From: Miaoqian Lin [ Upstream commit 77087a04c8fd554134bddcb8a9ff87b21f357926 ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write protection") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220523143255.4376-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/mtd/maps/physmap_of_versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/maps/physmap_of_versatile.c b/drivers/mtd/maps/physmap_of_versatile.c index 961704228dd2..7d56e97bd50f 100644 --- a/drivers/mtd/maps/physmap_of_versatile.c +++ b/drivers/mtd/maps/physmap_of_versatile.c @@ -107,6 +107,7 @@ static int ap_flash_init(struct platform_device *pdev) return -ENODEV; } ebi_base = of_iomap(ebi, 0); + of_node_put(ebi); if (!ebi_base) return -ENODEV; -- 2.35.1