Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3022524rwb; Mon, 15 Aug 2022 16:20:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR63JMc+PO21jfGPTPRzBYRLrgEjOWVA1Aru75T9bQUohiQ1+0332ZzTpUp8hvK1ola0NYoC X-Received: by 2002:a17:907:6295:b0:703:92b8:e113 with SMTP id nd21-20020a170907629500b0070392b8e113mr11868750ejc.594.1660605474564; Mon, 15 Aug 2022 16:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605474; cv=none; d=google.com; s=arc-20160816; b=twQkxSC7FvBb9pAZE7RTzv/YDLZX+t/sJkXGS1GOUmdr4QAqpZ0ceSEefgrDBHB8g0 3ffKx1vH3N30P41WziIbRXrseVAFcg50ciaLYPjmvRHKVRKDfsI/H8fdiszcLGstN9zl etONuN4+/wXFBwM0IJ5vjxv1kRfVdJGfR8sXltS6O9RvGP17b9Gqom++KKoC5zUYhW1s 8bo7DkvbG07wyxaQQiubDbvOK6qpV7wje30tOUPxiYRBR64Aitn0KhhclQAmGA1R3BIS 8UDZHjjjTAaD9v1GV+FJRQjDHzaSh8YAhUacsZLQpc1tGYexLiCwCxtgWeibReaAR1z7 0l+Q== 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=bkEnTkRMKQ0BWwW9iMcupC2W1WpZDgkyPXdRu42iePC9nWQ8r6bcAkRkN1Mz2GP1qz QZE6htPHskAbawirsMX38CV/V+HEcd8PDIxdaCpYEKjUSQYuArWOa9u3OpXz0YH7R0l2 CoGowln6Yh1BJ+b0w2HFb254Qhfmh2N0PHWjE9q7kMEVMhCpzMeOJFJ5U68hV+dPRtT1 HRBV/Z3KDJ+y66H4gkv64cKyUqj2AYL5AUvtXD+2bsame52T9T1VrrHlIUcdaccFHVjj o4RGNHqZQcfYXH7pAr93B8+KfbDucZKM9OA3ScfQ3u5wfV0bP/KoMqfpA0TB/0obqZFt YTsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Bfvbuk/O"; 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 e3-20020a17090658c300b00730cb783378si10319650ejs.13.2022.08.15.16.17.28; Mon, 15 Aug 2022 16:17:54 -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="Bfvbuk/O"; 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 S1348435AbiHOVdN (ORCPT + 99 others); Mon, 15 Aug 2022 17:33:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348208AbiHOVaN (ORCPT ); Mon, 15 Aug 2022 17:30:13 -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 0A9B1EF9C7; Mon, 15 Aug 2022 12:24:05 -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 F3CE2B810C6; Mon, 15 Aug 2022 19:24:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C30C433C1; Mon, 15 Aug 2022 19:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591442; bh=dUu8ueBkoD9WU0J+cgsPNoGbfDPcl41stYx5RPPV8tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bfvbuk/OhCHLRuVwV07yzWtLeCHfJZS3TfIgbdKhh3SgZCPN96f/rxcBqo+Uv0s3S s7k0PPcNJxmnjAXeq8FobRCqPrqOLk9FTPVmTKqvVDzExZOuvTNyimA9wKk0OwULft vrxZUbnOxSS63OYLiAGEL7hlBYr7SXTgWV4u6urU= 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.18 0542/1095] mtd: maps: Fix refcount leak in of_flash_probe_versatile Date: Mon, 15 Aug 2022 19:59:01 +0200 Message-Id: <20220815180451.967171685@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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