From nobody Sat Jul 25 01:37:30 2026 Received: from va-1-115.ptr.blmpb.com (va-1-115.ptr.blmpb.com [209.127.230.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C83C401A18 for ; Tue, 21 Jul 2026 03:05:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.115 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784603107; cv=none; b=stb2CQIFiKHL6sMnaurEHVJ3vyW61jESDfUjOmEWSalylgANfhYWdxrqU9LAFFeTLf75x+U5GUbQgLEBqj2E9y+gAn+99JXBRr6gxoxDQwL3OBuFqafWmHAm5geFHsuZRg/oSA82Vro5FJwj/S4Gyxid0bwEsDdI/tQLDsIQqfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784603107; c=relaxed/simple; bh=Ql7tvPDEHcB6W/Xldon6/EGWMlA7Et/bSiECyMRI8ho=; h=Date:Message-Id:Content-Type:To:Cc:From:Subject:Mime-Version; b=jIu2idXR2YTGgUfADklI26yJmKvcsMvh/0zYbIbckCBcV/qVS5uBoTFTPd2gqkp8ew/luSIZlCE0CZOX3+XqjQDse9c/BdhfDpf0exXhapaZHgwA+q45LEUwYRjGz2/JEwHio1eSMW6Y3OHgMq0bjzCkr9uQrptSB/uqXu66i3E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=muCfin8Y; arc=none smtp.client-ip=209.127.230.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="muCfin8Y" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1784603097; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=qUSNUwKvWg9GGUuE4HyURXlAstH9B0St6QaF81UwWMI=; b=muCfin8YdwkkxiP9o7V/nhrUYaHYXEYdLsbTRt6sW9Xq3+Tw/KSgWL2tnUsk6OBbpXqk0y /z0Ga+dCp0UWi29R4psKQbsGVshNNiLmKrRXuYmZzvBqDyNEs1FQ8azERtnwkGQK/TIGs+ roFWB/YQ4ZCxk4X4Jx9e+YjZa81f3vEhrRF84Z6hZRlD16yqDw1Jp9iZWATDqg0dYzFt83 C0iYvvXj5VWGG1s5eLgsHgk310YZ/2seLKmWtjG0sknweTkEFnHFmvNMAL5d243vBEldL/ zd00/4k8IQGDwy4Gkp51aLPVz9GA+oX+KjcZq/8CuZc/+rsIbyFjEhsXVH84Mg== X-Mailer: git-send-email 2.20.1 X-Lms-Return-Path: Date: Tue, 21 Jul 2026 11:04:42 +0800 Message-Id: <20260721030442.2639143-1-zhouchuyi@bytedance.com> To: , , , Cc: , "Chuyi Zhou" From: "Chuyi Zhou" Content-Transfer-Encoding: quoted-printable Subject: [PATCH] platform/x86: ISST: Fix perf level allocation error handling Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Original-From: Chuyi Zhou Content-Type: text/plain; charset="utf-8" sst_add_perf_profiles() allocates the per-level MMIO offset array used by the SST performance profile IOCTL handlers. If the allocation fails, the function returns success and sst_main() ignores its return value. This leaves the power domain registered with perf_levels set to NULL. A subsequent performance profile IOCTL dereferences perf_levels while computing an MMIO address, resulting in a NULL pointer dereference. Return -ENOMEM when the allocation fails and propagate the error through sst_main() so tpmi_sst_dev_add() discards the incomplete power domain. Fixes: 0ab147bb840f ("platform/x86: ISST: Parse SST MMIO and update instanc= e") Signed-off-by: Chuyi Zhou --- drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c b/= drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c index 24334ae70d82..5dc85f448be4 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c @@ -337,7 +337,7 @@ static int sst_add_perf_profiles(struct auxiliary_devic= e *auxdev, =20 pd_info->perf_levels =3D devm_kcalloc(dev, levels, sizeof(struct perf_lev= el), GFP_KERNEL); if (!pd_info->perf_levels) - return 0; + return -ENOMEM; =20 pd_info->ratio_unit =3D pd_info->pp_header.ratio_unit; pd_info->avx_levels =3D SST_MAX_AVX_LEVELS; @@ -400,9 +400,7 @@ static int sst_main(struct auxiliary_device *auxdev, st= ruct tpmi_per_power_domai mask <<=3D 1; } pd_info->max_level =3D levels; - sst_add_perf_profiles(auxdev, pd_info, levels + 1); - - return 0; + return sst_add_perf_profiles(auxdev, pd_info, levels + 1); } =20 static u8 isst_instance_count(struct tpmi_sst_struct *sst_inst) --=20 2.20.1