Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3405998rwa; Tue, 23 Aug 2022 04:21:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR48iI2ye21yq8jWhODfxxC2CXZVxbWDAZZS3PYI+2Gm/k9DHhfU1mH7Lpim1EJahesVY9Rx X-Received: by 2002:aa7:9486:0:b0:536:b212:172f with SMTP id z6-20020aa79486000000b00536b212172fmr8165312pfk.70.1661253702649; Tue, 23 Aug 2022 04:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253702; cv=none; d=google.com; s=arc-20160816; b=ztLIMyUK/2Aj3oionv5hn0IuO0z2HoIluqASa6+JHXB/rA4E/U6zvwJ5v/FnbK+sxp GPuxw+YErC+3uDpvf33azqU/+9EsdeTMeLu+gBung7UhTE/jDYvW1SjfcxhVHt7C/vH7 QKTMA6JzvhrQ+r/42CqiKyc7CEmj+QEuLtdgEkIn+MWOKqXB9DDEcpD6KuxXee6Fur0W UU7fUMWUPlizUdIB5Islcsuza7wHTx4758hos0x6PnDLwLGzqZYrq2k0u96ZPmW8tnDf h2WM6LWUeHiE5Kap7EIOY62ZxfsQw50aMkWI3kffoJMN8r8OZ5soBI/ykCGVO6B0RbJj VFkw== 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=zAnJ81H7H7k+zxBBJzZJwuK3xJQqIijnZSvj/RIrW4I=; b=Jq72uJv+w2YsXLW8UQID8sluYBTGNd4HDsmVrAzCS6IK+uVuBsBymLrjCfvuQ+jwob Rm/VKik0Fw2lXeM7uONTimifnnqBtjGtpTqne1qCnLxVuc7ZZvCf5LaWvsU11w+TLU+K FBWfIHYKkc+0IGIS85z2znb6PXc8KfkpE6w/1BDa82orVuyBUy8JtOdfxQa28sdvwMMB YOv90jJQfbtM97E1QNh0E7jycH71dZ6B7A12Efi8xMrpgc0ZEbHejIQ3Aluw157GdcKC 3w2KEFjxXIlo+XNN/PnSRv+ltLdoGoJGDS/ZKnFltqqJziejwF9p//koPGJvWNyYKZh0 a5zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ML0v913R; 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 oj15-20020a17090b4d8f00b001fab8938920si5709724pjb.152.2022.08.23.04.21.31; Tue, 23 Aug 2022 04:21:42 -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=ML0v913R; 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 S1356143AbiHWKlc (ORCPT + 99 others); Tue, 23 Aug 2022 06:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354859AbiHWK0g (ORCPT ); Tue, 23 Aug 2022 06:26:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72D6183F2D; Tue, 23 Aug 2022 02:05: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 ams.source.kernel.org (Postfix) with ESMTPS id 134D5B81C53; Tue, 23 Aug 2022 09:05:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70FBAC433C1; Tue, 23 Aug 2022 09:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245548; bh=gXJeB+CKeDu7TiKFHWZPHO1BsLZegk9X3IBL5reKvkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ML0v913R0zmyW9YZ/KLVBqzMqdDKuC3EFnDwz37x/NVatVOVDZsi+tzEqDN048dYU VdyAGgRdAjIwVJ2mGL91UfEqpDKpPQltAzcc0zhOFzGso8JE8Qz/eJIoq70fcHoeDB 45N/4d6OxylNo84njDuF6yAJKUv5P2KQzbjnAGko= 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 114/287] mtd: maps: Fix refcount leak in of_flash_probe_versatile Date: Tue, 23 Aug 2022 10:24:43 +0200 Message-Id: <20220823080104.218462230@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 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_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 03f2b6e7bc7e..961704228dd2 100644 --- a/drivers/mtd/maps/physmap_of_versatile.c +++ b/drivers/mtd/maps/physmap_of_versatile.c @@ -221,6 +221,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