From nobody Fri Apr 17 01:43:55 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 2B795396B91 for ; Tue, 24 Feb 2026 12:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771935680; cv=none; b=tuP+AoFJIgsijzkzPQU0rb0crbqsUA3J9wffPv18X5+nig1zDAKbzCcpuwZYdO82SF+2enepn0iy4EKC+wQT/RTRrXhXnvjOZpHUOE0xi1x5u4hRC21r2DJHYnqPp+j8+mg35DfQa+o5vxxUtvVFisKQlr6tX4+P0uabM2kQtZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771935680; c=relaxed/simple; bh=Z7lG3+MmWUHSBEpYz2jAKp2j1jBFLDcncGLZgsmhgmA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RoHuuFJ8NI+xt2HSz7HNISEqKNgL79drNHY8YMrEaCoQnAdizu5PePT2NXNmu0rbzOWOjOSd/35os7AA0HzLAhu1eZ4Xtz1JiY0AvH3olB/Z+U4L51oq9la3ikaOaTOwCbTyvsOuos0n1JVZFL+2P60yL5xd4Y7aa3DXE4f6mik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=F0gPnPS/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F0gPnPS/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771935678; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=D7Gfr7GUfvWmA2TjaJIS+S17ZwfwsborvxzxZUcJTAo=; b=F0gPnPS/ps1jnX4XpZvJHysR+/PYeIbgSCUwMT9XoTBDfS7Jjl6tVYJU74YDf09F05yotl h70MLEwrXhl+RLxUodJ91mSXzSUJ+rBmZ5d4fKPzm36dCqGMxr0JLYNdD7+/ZSOvSFbGD/ t7tlEzC2kWQQOvMQfSO/r7E4xOv4PGY= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-F4yYw0GrOBSolj6ea0XI3A-1; Tue, 24 Feb 2026 07:21:16 -0500 X-MC-Unique: F4yYw0GrOBSolj6ea0XI3A-1 X-Mimecast-MFC-AGG-ID: F4yYw0GrOBSolj6ea0XI3A_1771935675 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 198171800365; Tue, 24 Feb 2026 12:21:15 +0000 (UTC) Received: from dba-icx.bos.redhat.com (prarit2023-dbaguest.khw.eng.bos2.dc.redhat.com [10.26.1.94]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7CDAD1955F43; Tue, 24 Feb 2026 12:21:13 +0000 (UTC) From: David Arcari To: srinivas.pandruvada@linux.intel.com, lenb@kernel.org, rafael@kernel.org Cc: viresh.kumar@linaro.org, zhangzihuan@kylinos.cn, jhladky@redhat.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, David Arcari Subject: [PATCH] cpufreq: intel_pstate: Fix NULL pointer dereference in update_cpu_qos_request() Date: Tue, 24 Feb 2026 07:21:06 -0500 Message-ID: <20260224122106.228116-1-darcari@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" The update_cpu_qos_request() function attempts to initialize the 'freq' variable by dereferencing 'cpudata' before verifying if the 'policy' is valid. This issue occurs on systems booted with the "nosmt" parameter, where all_cpu_data[cpu] is NULL for the SMT sibling threads. As a result, any call to update_qos_requests() will result in a NULL pointer dereference as the code will attempt to access pstate.turbo_freq using the NULL cpudata pointer. Fix this by deferring the 'freq' assignment until after the policy and driver_data have been validated. Fixes: ae1bdd23b99f ("cpufreq: intel_pstate: Adjust frequency percentage co= mputations") Reported-by: Jirka Hladky Closes: https://lore.kernel.org/all/CAE4VaGDfiPvz3AzrwrwM4kWB3SCkMci25nPO8W= 1JmTBd=3DxHzZg@mail.gmail.com/ Signed-off-by: David Arcari --- drivers/cpufreq/intel_pstate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index a48af3540c74..bdc37080d319 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -1647,8 +1647,8 @@ static ssize_t store_no_turbo(struct kobject *a, stru= ct kobj_attribute *b, static void update_cpu_qos_request(int cpu, enum freq_qos_req_type type) { struct cpudata *cpudata =3D all_cpu_data[cpu]; - unsigned int freq =3D cpudata->pstate.turbo_freq; struct freq_qos_request *req; + unsigned int freq; =20 struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(cpu); if (!policy) @@ -1661,6 +1661,8 @@ static void update_cpu_qos_request(int cpu, enum freq= _qos_req_type type) if (hwp_active) intel_pstate_get_hwp_cap(cpudata); =20 + freq =3D cpudata->pstate.turbo_freq; + if (type =3D=3D FREQ_QOS_MIN) { freq =3D DIV_ROUND_UP(freq * global.min_perf_pct, 100); } else { --=20 2.52.0