Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3060866rwb; Mon, 15 Aug 2022 17:09:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR4O1swpbAo+H61w//9UmCxyKOqg8laeRZuT1Pd7du7Xkf59yWlSx+1jS/+1LyfcynT2n9kw X-Received: by 2002:a17:906:4bd3:b0:731:3bdf:b95c with SMTP id x19-20020a1709064bd300b007313bdfb95cmr11811266ejv.677.1660608585682; Mon, 15 Aug 2022 17:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660608585; cv=none; d=google.com; s=arc-20160816; b=CKQtOEbRyC/cmi9efYwPjgZ3pQIfkm6LEmTwcaFIbTpEIeNt9GsTGz8OMJr1w/X/iH JZFaJMcWRtHEupgjd/FYLEIJIggP0/5gT1cYfAyiZRstsVJ5zNwApqtRsk/c9b8nut5z Tea8adyC4OdAWSaJGOryAoHWn8E7ndLE9cdbBxztsh62TeilTeqC5C8VaI0AhCOzDhRK xf2wjHUwTY29a7zwK/eWgWGryQmKBDXR0yVQmqGsZK3JPJasJk0sRA1ZVt7sUgZKJrBs TIl0ICCuxe2IrYwHc54Os3jrg32Q6c3/GSvdQvcws6gkU0bdUSS6lHcEiBPoM4k1yoNH tqLw== 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=BoE41Tn8AJTsSjrAMRvU+7/sep5q4S8/qRf3qtw5qLA=; b=VZeIx/ipu5gigCuO1D9wBYbhjleeUjABEjyF5VWLw+TwvukfI1g4W/3k7zwwDIyY5h dP8knSYK5shsYbWPYnrLiF191lYuHCpcK/m7IBz7YIfsUhMn+mvZCCiyDZPyT5U/s14W 0QbNZOB5L1pA4uvEPu1c8C+eXzH/qm9Oj5h4j/UVNE3hnTLjraAGErQq4UzYf6SuxOhI /arnBugRPN1GmZyJHtbn7yv2mWNUi2WVtt6z1uHWvU0wz3gEE30rD9uvLwWZg/v06c2d FxY9f4vrB+x+/OFYF1h5JBMp3b92RSkjuA4Bv4r54IeBkXRiFVe/e5ohlIByNwoYwjTF kusA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="bDxv/jq9"; 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 y10-20020a056402440a00b0043e81c582d2si11135960eda.232.2022.08.15.17.09.16; Mon, 15 Aug 2022 17:09:45 -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="bDxv/jq9"; 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 S1355855AbiHPAGg (ORCPT + 99 others); Mon, 15 Aug 2022 20:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353754AbiHOX6s (ORCPT ); Mon, 15 Aug 2022 19:58:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23AF616570D; Mon, 15 Aug 2022 13:20:51 -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 B44826104A; Mon, 15 Aug 2022 20:20:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7457FC433C1; Mon, 15 Aug 2022 20:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594850; bh=Y2YVxMxFUYn+u8NnVUBKFgPVl4Mn/bDpZE1Y3UP0Zr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDxv/jq90rwahH/v1UWCGFhaxcKcNkL81PrJy05e2Hqr/fiJbGJ8HBgNbG8WWYHmo Km6JZ0dwKVwACJUsNNC7i25ZXJPz/zDy5TjJuYZl2Nk8HOsfQPeq/KzCTncHbYdaMy RrjEw+8JWVvO1HN6d6NNiAvffoOHQPVVcVI4tr7s= 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.19 0577/1157] mtd: maps: Fix refcount leak in ap_flash_init Date: Mon, 15 Aug 2022 19:58:53 +0200 Message-Id: <20220815180502.720818621@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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-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 297a50957356..a1b8b7b25f88 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -93,6 +93,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