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 4EE2A3C1FD9; Thu, 15 Jan 2026 17:52:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768499568; cv=none; b=fHbd9sLilx15KIi5jgt5dAsjoo5o8dBm4vr6nenuKpRjLPgPt3GxUO7KJ4RRxToCmkrxgIB2IC8ZopZgedR7OXMdAAblh2tPmq5ahQnTxP/SwijGxzIWstBwytezzehXvTltxgUTxG1yXkEAsGhOsQldXnl2O4XOxm7baH197NU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768499568; c=relaxed/simple; bh=33q5sfb/X5NAvH1e1mKaMR3uouOwZ6qmn63uwQrAOyg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JHoaSnsLTm3zmLSYpHEa2XhtR8gJQEicycwkvsYzjEfKii3QrHcGKEAxN02NpycdGF46biXF9oKz3+ZLL/zd7ZHMnl6nhmkgSnfgWSWpl7mg1bHKpZTxL4ofEWfz4TzvIF4ldiP7zwNjUT1diuVhWdZxmWpEuaRb7iws3IBB93M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GIc6Nk/R; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GIc6Nk/R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0D6AC116D0; Thu, 15 Jan 2026 17:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768499568; bh=33q5sfb/X5NAvH1e1mKaMR3uouOwZ6qmn63uwQrAOyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GIc6Nk/R4MY/swGaSdgfr9xVZWRwNn+wWsxfZO5of5q5DjEL3/I4I3i2iYrhSPfGW LXltPBOUtATZpl9GfsbZOTgT+OJlseSjSQJoMlZk6h9//hDBtmBCYzODz994r01h1e xpl0t4PeSLPA1xJw2vnwatbHjX62Vm/xtFxa+L+k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Miaoqian Lin , Viresh Kumar Subject: [PATCH 5.10 239/451] cpufreq: nforce2: fix reference count leak in nforce2 Date: Thu, 15 Jan 2026 17:47:20 +0100 Message-ID: <20260115164239.539285015@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260115164230.864985076@linuxfoundation.org> References: <20260115164230.864985076@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Miaoqian Lin commit 9600156bb99852c216a2128cdf9f114eb67c350f upstream. There are two reference count leaks in this driver: 1. In nforce2_fsb_read(): pci_get_subsys() increases the reference count of the PCI device, but pci_dev_put() is never called to release it, thus leaking the reference. 2. In nforce2_detect_chipset(): pci_get_subsys() gets a reference to the nforce2_dev which is stored in a global variable, but the reference is never released when the module is unloaded. Fix both by: - Adding pci_dev_put(nforce2_sub5) in nforce2_fsb_read() after reading the configuration. - Adding pci_dev_put(nforce2_dev) in nforce2_exit() to release the global device reference. Found via static analysis. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Miaoqian Lin Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/cpufreq-nforce2.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/cpufreq/cpufreq-nforce2.c +++ b/drivers/cpufreq/cpufreq-nforce2.c @@ -145,6 +145,8 @@ static unsigned int nforce2_fsb_read(int pci_read_config_dword(nforce2_sub5, NFORCE2_BOOTFSB, &fsb); fsb /= 1000000; + pci_dev_put(nforce2_sub5); + /* Check if PLL register is already set */ pci_read_config_byte(nforce2_dev, NFORCE2_PLLENABLE, (u8 *)&temp); @@ -432,6 +434,7 @@ static int __init nforce2_init(void) static void __exit nforce2_exit(void) { cpufreq_unregister_driver(&nforce2_driver); + pci_dev_put(nforce2_dev); } module_init(nforce2_init);