From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796327745; b=zYSTI79/XtTwhhB2fpxKSxMLGDLotBDaHJo7QoirxiEbklipNnEbHvSsUfzerfAQgQ5P 7ZFN1Ikobe0v/4EP75Oqtms58+KqM9nyB9O8scd2Nh952uJgG2tjkW8YfFRIT1Wp7rWc0 NDUo/dCo6KJkjj5Ran82bM6YMLu8Uk1cOPyT1ffe9gGNyb/ZlJSaSgG8eWMWaisAk6vlQ E0wN0wqVVgRp3NXItPksCZwdX9ipe/WkypAJVGjz6pquCDnKv7/B3BtcKGocHnbbkBl8R lWPVgZJh+yl4rLlYi3kblolNLrdBUkqZcVoZEx+gkDpFVUKjFLhZKPq0NCZT0aE/ppQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796327745; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=n2VszcKjp2jtoGbgSUneQUV0GWignfoEptYjxv+4FpA=; b=r0AelsOk2TQul0YWII6gkRaQybxgHA3MHoyjkyxAIw45Ex8IV8hL+eUOtwrllSTILZYd /gzOwQ7jGAarGjO6BQjtltuX+mSm9F7EEX5Vg5dRyW8zEQbYln7WqNfwjAVE69GU0n2Uh rV9Pm3lSGIRxRVvfZfekPorTxICR1UDdPmy1Hvqua8ZkvCUZo1Oo4xGNF9wpsOrf/OsQ6 IZtMwmeFm2OwWc7owpowCmJzQhEjsc+9pXu2vhzMut+n6Gj8tQeRbHjBblPYqzJnPfaY+ 9hazi4z8jcVr4gSRzfUiB5YwM1vjpnGsXeXSRE5Nlv/8PeLgCwORHnJah3ykrvNo7Yg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HBrErhh7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC05A606A330; Thu, 3 Dec 2026 19:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HBrErhh7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5894B1F00935; Thu, 3 Dec 2026 19:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796327745; bh=n2VszcKjp2jtoGbgSUneQUV0GWignfoEptYjxv+4FpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HBrErhh7O99cvDHQqoXgMjXOBoe2tMM8tFrWgTnfmZPkIn0dlrqnUE+mIudQ5TR5i RklieB6A7utFCOoHIWQSYzD/h9OGoBqCnNb9YvzsTOxtj8WcV1HH5lhiW/l+4sFaeN DaO4zyTffjsSIoxPPHJtij7nOeex9CGI/CAX+xqFQ25cWj3/5UcDrODwfXTv6SznZ6 FDhe3nwbcF8G/HuKubWbrWxyodTqn/hFIaQR3kt0SD5vaBB4ZZzk2+NAmFeNZEdD9+ TnIkVMxplqerXOPH1yvDC6223J20cdoTgXyfHMdkSXf1M1MHH6QCbPv2RK1sGitbqY g/Vep3wj5wX8Q== From: Lee Jones To: lee@kernel.org, "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Jez Ng , Aubrey Li , Ricardo Neri , Len Brown , linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 01/10] thermal: intel: hfi: Pass byte size to alloc_pages_exact() and free_pages_exact() Date: Thu, 3 Dec 2026 19:54:12 +0000 Message-ID: <20261203195529.3063246-2-lee@kernel.org> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog In-Reply-To: <20261203195529.3063246-1-lee@kernel.org> References: <20261203195529.3063246-1-lee@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit intel_hfi_online() passes hfi_features.nr_table_pages (a page count) to alloc_pages_exact() and free_pages_exact() instead of the table size in bytes. When CPUID leaf 6 enumerates more than one HFI table page, only a single page is allocated, allowing hardware writes via MSR_IA32_HW_FEEDBACK_PTR to corrupt adjacent physical memory and intel_hfi_process_event() to read out of bounds. Convert the page count to bytes using hfi_features.nr_table_pages << PAGE_SHIFT, matching the local_table allocation. Fixes: 2d74e6319abe ("thermal: intel: hfi: Handle CPU hotplug events") Closes: https://sashiko.dev/#/bug/linux-213cb649-d604-43fc-b43b-8cb453a252d6 Cc: stable@vger.kernel.org Signed-off-by: Lee Jones --- drivers/thermal/intel/intel_hfi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c index 8ff094eccbaf..19355679c1df 100644 --- a/drivers/thermal/intel/intel_hfi.c +++ b/drivers/thermal/intel/intel_hfi.c @@ -470,7 +470,7 @@ void intel_hfi_online(unsigned int cpu) * even after having been reprogrammed. Keep using the same pages. Do * not free them. */ - hfi_instance->hw_table = alloc_pages_exact(hfi_features.nr_table_pages, + hfi_instance->hw_table = alloc_pages_exact(hfi_features.nr_table_pages << PAGE_SHIFT, GFP_KERNEL | __GFP_ZERO); if (!hfi_instance->hw_table) goto unlock; @@ -508,7 +508,8 @@ void intel_hfi_online(unsigned int cpu) return; free_hw_table: - free_pages_exact(hfi_instance->hw_table, hfi_features.nr_table_pages); + free_pages_exact(hfi_instance->hw_table, + hfi_features.nr_table_pages << PAGE_SHIFT); goto unlock; } -- 2.56.1.911.g883d8bcb20-goog