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 245EB3CB2E0; Tue, 21 Jul 2026 22:45:17 +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=1784673918; cv=none; b=FsKyGB9xkszIFWFluG8RMidgxQM/3Y1hgAG5gV+9R08jgq2ncV4WJ8THLTP0wogC3h9xJj88Iecnic+whZq+lAmK9vkcJuZ/BEmEG5Dp5VCsv0ntkMRa/qbIk3IbfKLRzVAuVjo0I1KqIuYoDgDPdmDsW1/eMZfhGqrBroHB+0w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784673918; c=relaxed/simple; bh=/ha7l34h5C1gpkSWo2TF06wte3Zivoeve3lG6qPFnK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a8BysYDgl81kA1O7p19epHnu2GZrdRk3LYltF+1ocAPFWGYDNlRSzUGbZ0xMMFS1CoWs2F8s7auyUoASg3xWu3Jx/N0mb0KynF1nJ26JRCo5hhypBPjp3yg7T6n83UV/eSig+LNwnv4PUsoIM3nlW3ULnF7KnRz4MdwIWNVLboQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GZhcYSEo; 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="GZhcYSEo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 898091F000E9; Tue, 21 Jul 2026 22:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784673917; bh=8zUH0G49PYzDFnYmvE0JBx8Y2ELYWhqgCcc/OPf+keo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GZhcYSEo+9GW7VSFaa9OEiZEGlwu5nDsSR2KrRZ+kpgJCLogVcNv2c8jIEYmWtFYx Fm4oWjjZiSCDLTNtZtWelZx/j0cBEN5ZvmE5xc2fBS/v6ziY8SWejvWT990CBWkp9X RCmddDq8uGcoDF27JmDBL33NQl/Kr2xkNyhdHx8I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ricardo Neri , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.10 343/699] thermal: intel: Fix dangling resources on thermal_throttle_online() failure Date: Tue, 21 Jul 2026 17:21:42 +0200 Message-ID: <20260721152403.429792332@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ricardo Neri [ Upstream commit b91d287fa7a1ba0727eed5823c6ee4924ee5fa31 ] The function thermal_throttle_add_dev() may fail and abort a CPU hotplug online operation. Since the failure occurs within the online callback, thermal_throttle_online(), the CPU hotplug framework does not invoke the corresponding offline callback. As a result, the hardware and software resources set up during the failed operation are not torn down. Since only thermal_throttle_add_dev() can fail, call it before setting up the rest of the resources. Fixes: f6656208f04e ("x86/mce/therm_throt: Optimize notifications of thermal throttle") Signed-off-by: Ricardo Neri Link: https://patch.msgid.link/20260613-rneri-directed-therm-intr-v3-1-3a26d1e47fc8@linux.intel.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/mce/therm_throt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/therm_throt.c b/arch/x86/kernel/cpu/mce/therm_throt.c index a7cd2d203ceda6..52c9269dd3a820 100644 --- a/arch/x86/kernel/cpu/mce/therm_throt.c +++ b/arch/x86/kernel/cpu/mce/therm_throt.c @@ -467,8 +467,13 @@ static int thermal_throttle_online(unsigned int cpu) { struct thermal_state *state = &per_cpu(thermal_state, cpu); struct device *dev = get_cpu_device(cpu); + int err; u32 l; + err = thermal_throttle_add_dev(dev, cpu); + if (err) + return err; + state->package_throttle.level = PACKAGE_LEVEL; state->core_throttle.level = CORE_LEVEL; @@ -479,7 +484,7 @@ static int thermal_throttle_online(unsigned int cpu) l = apic_read(APIC_LVTTHMR); apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); - return thermal_throttle_add_dev(dev, cpu); + return err; } static int thermal_throttle_offline(unsigned int cpu) -- 2.53.0