Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3090664rwb; Mon, 15 Aug 2022 17:53:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR5zWsTRC34ePNegqit9ncdD2nswudSjHUGTUz4rVds6YgXQ1lG6x+BYDcB6Trr/17Neadm8 X-Received: by 2002:a05:6402:190b:b0:43d:d001:2cce with SMTP id e11-20020a056402190b00b0043dd0012ccemr16488100edz.326.1660611238317; Mon, 15 Aug 2022 17:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611238; cv=none; d=google.com; s=arc-20160816; b=res0CCdnUVoGbW/8srHU5dbT5m2LZrsbCgsY7W6LNN8p+v8Vq3Xhlq1Wr4AWfVgkG9 khEaSB7SlW8tYRMphLi2H7ALhlEQGXVvNdR7rP4ZcN2X+s56s627tO5t+PQe/dFObqJz fD1qx9okL3bZXQoVRVa8dfK2+BXTY0JetsUi2ratIikvICx33+MZu18eO3QFmiBdsj/m UUxi2EZVQsbGkmSkMMC0GgRm0O+u5oqh6X7zCMoqIoCT8UYLE6Re4EDqGqEp6upjSBCC KZZWSOkyk6wQ+a8/nqz/iKE+mDW8Z2otsJE8k13b4H4sz0tNf0cLA/i8LNqIddHrEsDz pd8w== 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=7enhZuls1JzmOswiFRoiJech9nR8zTPt+cQKECTgwJw=; b=QY6oR+BalNXUAhEka3kkcKwx9ZwRxX5G1GRsp6mIukOkDB8aSjIh6ZnsDMvgct5NiH +O59f4n78ESt+IsMIyRWC4KMwR1wFzuOe478lep1oSwtCy03VNtv2aK3gM4BNvPH1lxs KvgqL1QQV8WBIctnu1n3nivEQwNRsEtXdkpN2baRjq0tEghH+xOb8OWjerh0MYuntZ4k RsVmPeJIlPLBeP5Td0Twi5DGMi+1TcJ9lbsM0/Ar5WzqV4gsAzMj4b7GQyKzxx9qDOav r2kNJ2hsBz17XggFK8IMVxNz7E6sO79WbZCu9eTONA1dSzrZKpOmbhUh62yyuQ2p6n8q xemw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BEACWF9p; 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 bl8-20020a170906c24800b00734c5ab8572si8321738ejb.157.2022.08.15.17.53.33; Mon, 15 Aug 2022 17:53:58 -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=BEACWF9p; 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 S1353033AbiHPAYg (ORCPT + 99 others); Mon, 15 Aug 2022 20:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357429AbiHPAWj (ORCPT ); Mon, 15 Aug 2022 20:22:39 -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 8674A17CF81; Mon, 15 Aug 2022 13:33:52 -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 1B938B81197; Mon, 15 Aug 2022 20:33:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA7E2C43470; Mon, 15 Aug 2022 20:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595618; bh=SY2E2wXYD56yvEtvgGm7t9vW1KbZ8dTo7tvk4SOguHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BEACWF9pR9EW/kcyc0GV+a6Qvm/BHGwWfq2DCfeJ3II369EFg4Frx3CApN/U6z+nU wv+IdEXmRjnAk+Ez41eWxASeEwMwEIXNi8U2KfFIhvHn8Bmc3Fwyw7J7GO/PaCXc8C 6Ayvb9c1Cfd4kIDFBVtlTQig+sl9mG8fPGdV+iEs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Ulf Hansson , Sasha Levin Subject: [PATCH 5.19 0794/1157] mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch Date: Mon, 15 Aug 2022 20:02:30 +0200 Message-Id: <20220815180511.245407404@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 b5899a3e2f783a27b268e38d37f9b24c71bddf45 ] 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. of_node_put() checks null pointer. Fixes: ea35645a3c66 ("mmc: sdhci-of-esdhc: add support for signal voltage switch") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523144255.10310-1-linmq006@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci-of-esdhc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index d9dc41143bb3..8b3d8119f388 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -904,6 +904,7 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc, scfg_node = of_find_matching_node(NULL, scfg_device_ids); if (scfg_node) scfg_base = of_iomap(scfg_node, 0); + of_node_put(scfg_node); if (scfg_base) { sdhciovselcr = SDHCIOVSELCR_TGLEN | SDHCIOVSELCR_VSELVAL; -- 2.35.1