Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1865081rwb; Fri, 19 Aug 2022 10:40:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR4WyUB2D2HRDuZrFFkB6gnq2Epy/ua8V3WoqLqdP129esgXbfm4bXsMYr3JgL5TEx3cpW3i X-Received: by 2002:a17:902:8b86:b0:170:d739:9a35 with SMTP id ay6-20020a1709028b8600b00170d7399a35mr8435568plb.35.1660930808988; Fri, 19 Aug 2022 10:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930808; cv=none; d=google.com; s=arc-20160816; b=wzsAJrhlWg6NvEl3CuUmxSz4f6PKjxNY7QS7TjO6L+pi1Ud7NEDQh3N4rROjgCf3mu 7B66P4AdkEsX383z03rCwWuh8TUuUclJ2Jg+6jXrybKaYxuJjydv7AeGJ25w8lqdOB7u F5Dbb9tw4DM+pDmPcJpZvvPGIALzZYDWSRrnwPR+GiWAFa/MkYRLReKVr4nCT8t8UdUs 85Q3XTASe6CE2+JfS6eJqhPHsND3ocE+jSJCTdo1eLVnesFUwQ0Lcq5WWwH5VR2kVqFx Gepm7VEWd92KPxxbV1ks7lJ5AO3MbmyAXqFauchP3izcDhHy4A7DNrj4uXrXBZxhEl9P fe5w== 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=Ett/ekqDdZGX8mYOoat/ni84ESApOyU8nGz/rmtKwrA=; b=svX51avmEyScwaRYgEvEtOHOfH/5NGs/KYZWVjNXuw03eJ4OqPD1vQ9SKLgl+oUTmQ APfT6UVgqbqy+TD2VR7am5300CGfB5oLlMrAwTl0xqMAzDdy+y7ASBqRBYW4HenvB9Ig x/VFHgJIb0u6M28IEGNwYAtXEiFfOrT3i+XCbyhoOw6Z0kSr6xi2ITVwF4juPOasR9lT 0abG+W+BxHeoQPT/8QoiMZ8mzYQIDemGmemLHnWyGZi8HbTzapk8gx/qL6ciPAAY0Sxf MzxrC4NyORXKmf2hc5yWkHRGL/KpBtlFFM/GhlP2zbZaBc0qWKJ+ZumMnqsa7++uJvtf 1Pww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PMClyR2C; 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 m2-20020a170902768200b00172bb852a27si3368675pll.256.2022.08.19.10.39.57; Fri, 19 Aug 2022 10:40:08 -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=PMClyR2C; 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 S1352515AbiHSQXB (ORCPT + 99 others); Fri, 19 Aug 2022 12:23:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352249AbiHSQQF (ORCPT ); Fri, 19 Aug 2022 12:16:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FF91108B04; Fri, 19 Aug 2022 08:59:11 -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 2C783617B6; Fri, 19 Aug 2022 15:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30F53C433C1; Fri, 19 Aug 2022 15:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924750; bh=dUu8ueBkoD9WU0J+cgsPNoGbfDPcl41stYx5RPPV8tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PMClyR2CXMIh5ggA7/szONT3KGPSPQfim4/tzqoC+JwYcU6FI6Q+rmCFvNEpaCaC5 /6PFOrPr66y4Hi35QYisuC4oc5C0dNaCmj8I6CDGPHDF0F0mZ40bufRKn144gaA4CO r8LaJCyFLmO/BMk5weUn2xc9k+nkFno6t74ISE7A= 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 5.10 270/545] mtd: maps: Fix refcount leak in of_flash_probe_versatile Date: Fri, 19 Aug 2022 17:40:40 +0200 Message-Id: <20220819153841.412789570@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 33ec82a6d2b119938f26e5c8040ed5d92378eb54 ] of_find_matching_node_and_match() 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/20220523140205.48625-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/maps/physmap-versatile.c b/drivers/mtd/maps/physmap-versatile.c index ad7cd9cfaee0..297a50957356 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -207,6 +207,7 @@ int of_flash_probe_versatile(struct platform_device *pdev, versatile_flashprot = (enum versatile_flashprot)devid->data; rmap = syscon_node_to_regmap(sysnp); + of_node_put(sysnp); if (IS_ERR(rmap)) return PTR_ERR(rmap); -- 2.35.1