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=1796387702; b=P+v+te7FdIFD9Nki5xQ6aMQHCY+n3CcS2H+CuTBF2U6d0KAja7H2EhwbqTXa4hb4/ub8 myn6UDBas0unh796cFlB7Pds9mV8pvLzs99yWTFqYOmsoK5CC5eZs3xUH336hcRDTZFAA YPTHykm1UzoU6m/Blzgd3B5HZVpB+vqHXdMtzKaKa4Jsd/GmC7AcqI9w2EJLngTfNjieg AFx/qUVJsrMBhl/TgiPmCJzKTJdNBAOWh2s6ESBOZ7YuYZbzKQccxqIJ4pqdamgF1i4Sl pfT+lHr8LEE0l2RNH95u6K5P9zdUDg81/1QLjVyR7htLAfIBcNn1vRHAks725Jp6qOw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387702; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=I4qzp1wGPwWF2s1jnvbzXZudTZkz5YJlB0v9k+bNAlA=; b=C2f/wXeIKd70LaQmbkq00S0+aJfrEGvWTpxakTAUEUzBHccIlc5M7Kbq8vevS9hCtMXf qhTtgQBSZYmDP8VPUpleAEMjVfg1oisXFhE0YgzpyPkfa3vLesZJTp9QqfEre4txzqkf2 uCo2QzpzLwSUVKOq8nC9LMbLT86zRBvDpRd/Xc2t4lA2PCGmEYF3Cndl/Pvv82fbxJlQe mvm5ZDHHazWKerEeTfFZstUr6y9xUKIIeGgItVMRsKNeAmtUC0GuCx7IdRIkzll5WiRck kZl1dGxmq2lF86QlTX9tJXPKq30XHUwKj6j2N3tnZ3LJudeeyMRJgzaoqF2CftkRdpw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Xr+vczbi; 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 AC3F3606A337; Fri, 4 Dec 2026 12:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Xr+vczbi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25BA61F00897; Fri, 4 Dec 2026 12:35:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387702; bh=I4qzp1wGPwWF2s1jnvbzXZudTZkz5YJlB0v9k+bNAlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Xr+vczbigRB9K6PcRZf/X3tfHCGz3YQwMO6WMKdB0zO6rXIUU7515a22lvegKvNwY OfoDnfCBcVK8gMn3CvUBCOpTkOIjBrc/uFBZpVe3cOjgTOw7pJah4LUvHfztcvkF5w zEXKomgZ18azZYM4NteGmdeRM/K2ZWVWg7cy88Jk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Felix Fietkau , Sasha Levin Subject: [PATCH 6.1 0354/1059] wifi: mt76: mt7915: unregister thermal cooling device on hwmon failure Date: Fri, 4 Dec 2026 18:58:05 +0900 Message-ID: <20261204100653.439397004@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felix Fietkau [ Upstream commit b8286bc7fe520e7117e7b6e1a1fd4c0df439aa3a ] mt7915_thermal_init() registered the thermal cooling device and its sysfs link, then returned the hwmon registration error without undoing them. The cooling device (not devm-managed) and the link then leaked, and its callbacks referenced the freed phy. Unregister the cooling device before returning the error. Fixes: 0ae3ff568451 ("mt76: mt7915: fix hwmon temp sensor mem use-after-free") Signed-off-by: Felix Fietkau [ sashal: Added mt7915_unregister_thermal(phy) to the existing IS_ERR(hwmon) check, since the surrounding throttle_temp initialisation meant the upstream return lines had no context to match. ] Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index cd9bf39861158..cbe3780474249 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -194,8 +194,10 @@ static int mt7915_thermal_init(struct mt7915_phy *phy) hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, phy, mt7915_hwmon_groups); - if (IS_ERR(hwmon)) + if (IS_ERR(hwmon)) { + mt7915_unregister_thermal(phy); return PTR_ERR(hwmon); + } /* initialize critical/maximum high temperature */ phy->throttle_temp[0] = 110; -- 2.53.0