From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37B43746A for ; Thu, 12 Jan 2023 14:02:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D962C433D2; Thu, 12 Jan 2023 14:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673532135; bh=pDnMdryvZwl/j64L3ojctuAGhOOqZ5WcWCiObwwRsFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2frCCTC1EpijGXCxuUJKt1+6YfJFnbqMeJOWlq9PstuXC0pC0VbiyT91Hz9+lq0A N4mkuZijBJUsJ6BNGXfgCzb7EZ/Jo5L87U/cafP/6bZSU5GhCg5bS/UCE++mRwu/9I sAUs6eWTLBGUDApBwDK9v1anuCSTg1YS4zOMMg3c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiongfeng Wang , "Peter Zijlstra (Intel)" , Kan Liang , Sasha Levin Subject: [PATCH 5.10 063/783] perf/x86/intel/uncore: Fix reference count leak in snr_uncore_mmio_map() Date: Thu, 12 Jan 2023 14:46:19 +0100 Message-Id: <20230112135527.066492373@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230112135524.143670746@linuxfoundation.org> References: <20230112135524.143670746@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Xiongfeng Wang [ Upstream commit 8ebd16c11c346751b3944d708e6c181ed4746c39 ] pci_get_device() will increase the reference count for the returned pci_dev, so snr_uncore_get_mc_dev() will return a pci_dev with its reference count increased. We need to call pci_dev_put() to decrease the reference count. Let's add the missing pci_dev_put(). Fixes: ee49532b38dd ("perf/x86/intel/uncore: Add IMC uncore support for Snow Ridge") Signed-off-by: Xiongfeng Wang Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Kan Liang Link: https://lore.kernel.org/r/20221118063137.121512-4-wangxiongfeng2@huawei.com Signed-off-by: Sasha Levin --- arch/x86/events/intel/uncore_snbep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index aa5da42ff948..2fd49cd515f5 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -4681,6 +4681,8 @@ static void __snr_uncore_mmio_init_box(struct intel_uncore_box *box, addr += box_ctl; + pci_dev_put(pdev); + box->io_addr = ioremap(addr, type->mmio_map_size); if (!box->io_addr) { pr_warn("perf uncore: Failed to ioremap for %s.\n", type->name); -- 2.35.1