From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9B3473AFB0C; Tue, 21 Jul 2026 20:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665180; cv=none; b=DcHcKnFANP0o/l+GUAr/KgcOCKe0PWiD3rvlOaFJ8QWUDfMLkzSGMEHtELnjIMVhZ+I9fBkx0Ykrm+ELwi9GgxnpJeWM8oo94eN9x8FwHGvk2XhDfJeiGjej5TOtJp2i2zLqqcWAZLIoobb9gXZJY96uGz+KYao9x5CnukoMk60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665180; c=relaxed/simple; bh=NesHZL9eaArHCXNNXRiYxUxbuzVKQxTY0mQF3fcnskA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JO0V7Uxo4+ddzbozQiIuMCfGQffgwOJ1UlgaTB6UjiIIlqGwUvpBh0gfiNuxZecIRpRc06jRPesVLQqhiCfTL2MXkumsW+kTTEkoS7gOXgL0DtG1RlUfv6DmZgtKmqLZMGfx7Pid1OyqJNA4J2t5hJSCUFUsOE0rBmexBQ7otcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ChLQ4Flz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ChLQ4Flz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CD221F000E9; Tue, 21 Jul 2026 20:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784665177; bh=bFTmm4AZY4Dd3HELg/H40fw+4OVfa6vOo1wvT/7Fe7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ChLQ4FlzovvDhZ2yhZ/Mk04ruYN35L6z0Pw0bvgJ/Es4ZcuLG9nc7kTDdwD5bKtv9 xoZL3CAXb4yDtpVp/ONleVLAGHcWu5vH2nMGHuaxcWukkN8onIYhXnMDrW00QD3rLa 85oImg2swMQtnR8cD7Qk2EQrAuBXMnu4Nlx0vjuQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tianxiang Chen , Zhongqiu Han , "Rafael J. Wysocki" Subject: [PATCH 6.6 0206/1266] cpufreq: Fix hotplug-suspend race during reboot Date: Tue, 21 Jul 2026 17:10:43 +0200 Message-ID: <20260721152446.424139135@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tianxiang Chen commit a9029dd55696c651ee46912afa2a166fa456bb3e upstream. During system reboot, cpufreq_suspend() is called via the kernel_restart() -> device_shutdown() path. Unlike the normal system suspend path, the reboot path does not call freeze_processes(), so userspace processes and kernel threads remain active. This allows CPU hotplug operations to run concurrently with cpufreq_suspend(). The original code has no synchronization with CPU hotplug, leading to a race condition where governor_data can be freed by the hotplug path while cpufreq_suspend() is still accessing it, resulting in a null pointer dereference: Unable to handle kernel NULL pointer dereference Call Trace: do_kernel_fault+0x28/0x3c cpufreq_suspend+0xdc/0x160 device_shutdown+0x18/0x200 kernel_restart+0x40/0x80 arm64_sys_reboot+0x1b0/0x200 Fix this by adding cpus_read_lock()/cpus_read_unlock() to cpufreq_suspend() to block CPU hotplug operations while suspend is in progress. Fixes: 65650b35133f ("cpufreq: Avoid cpufreq_suspend() deadlock on system shutdown") Signed-off-by: Tianxiang Chen Reviewed-by: Zhongqiu Han Cc: All applicable [ rjw: Changelog edits ] Link: https://patch.msgid.link/20260408141914.35281-1-nanmu@xiaomi.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1970,6 +1970,7 @@ void cpufreq_suspend(void) if (!cpufreq_driver) return; + cpus_read_lock(); if (!has_target() && !cpufreq_driver->suspend) goto suspend; @@ -1989,6 +1990,7 @@ void cpufreq_suspend(void) suspend: cpufreq_suspended = true; + cpus_read_unlock(); } /**