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=1796385442; b=bcEYYbOnY/pLMJbXVWAw+cFzsmloqK7aKU12UabyzpbyPz77d9vM8tchaWfzQqmbAJF4 4CJ2ie+bs9RQoKQUNImhIjUSaAc7IH0bV0FeKMlahtxBrQY46ZF9aH/gMqJxcUtb/RyFw bBUR5Uvcj/k6RTqY5Mq8NfL3mx21Ws5XH+VHooqN1YOzKZ9dQ47HO+gV+b/zBju3kDVd5 bNbdQjEJADfWqf7HJStg4eULUKCbTfD0jmozHHftmZBSgUglLkoAiVVUuRSMSFlGVRKTN FiYd47AIOTkDHDxhnymSKxx3YS7ugl/UO3iEG6enwL+GXVf3e0QZXoSD5ZpsU9pXSSw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385442; 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=ZqwAhO1uOaD22Xzyha3+jZbeZTIYDQ19ZPM+NN9g6K4=; b=NXz4bWKigludGuq3wJp2bLzPgKQMJjUP6Sr5vJzdeXVEJLub/kqo/+ToT059gS+yy5dZ d4aAJ/rmlZTaxkiG2uktdVFRP99ZH0R2q9zm1WkBvIuGgAnZLOhs87xWW3RZWDKVB+1Zv eGyk+SED5mRHx3jkiGVADV7bT6/KpcuC/zjLJ2FqrTp/XdbjZn1080/ze7vdCGNGk1Fuu Rr7ji5OZL2YmFThZHGTN4yEhS+KANaKxxMqGdsdTLmAfNz5Iq8bppZDa7w+5LcbOZQAi0 U2xlfbf2Pog8nfkLCnnGNyOt1fxjfG7CbIfugneAlSZtg6KFjJPbaRDkz5DHfHOU1dA== 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=Z0zbGwd7; 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 7A281606A322; Fri, 4 Dec 2026 11:57:22 +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=Z0zbGwd7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9F611F00A05; Fri, 4 Dec 2026 11:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385442; bh=ZqwAhO1uOaD22Xzyha3+jZbeZTIYDQ19ZPM+NN9g6K4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Z0zbGwd75G6j+RU5TgQBnn6KR4Gf6gMuMni4mith/cTxhdg1pr8T9JJUh/HaIg1mz b8Kw3yTYF2zsoU3kcV49CG/ubJG0X4hm7EjFHlyFTLiFiqs7SHet5s7D+ObB7CqJ6e TkCbvxKO7TBlhWfVqkrZxvorxgDH73Vy/x1v5IxQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Sudeep Holla , Guenter Roeck Subject: [PATCH 6.6 0559/1167] hwmon: (scmi) Check channel config allocation Date: Fri, 4 Dec 2026 18:59:46 +0900 Message-ID: <20261204100716.609962897@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sudeep Holla commit a2996d892d0150d059d39c683d95d6fd7a37630a upstream. scmi_hwmon_add_chan_info() can fail to allocate a channel's config array. Ignoring that error leaves a channel with a NULL config pointer in the hwmon chip info, which hwmon dereferences while registering the device. Check the helper's return value and abort probe on failure. Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-d10ced6b-a6f0-403b-9619-f5a6573f9e7f Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI") Cc: stable@vger.kernel.org Signed-off-by: Sudeep Holla Link: https://patch.msgid.link/20261109151927.1672956-1-sudeep.holla@kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/scmi-hwmon.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -228,8 +228,8 @@ static int scmi_thermal_sensor_register( static int scmi_hwmon_probe(struct scmi_device *sdev) { - int i, idx; u16 nr_sensors; + int i, idx, ret; enum hwmon_sensor_types type; struct scmi_sensors *scmi_sensors; const struct scmi_sensor_info *sensor; @@ -297,8 +297,12 @@ static int scmi_hwmon_probe(struct scmi_ if (!nr_count[type]) continue; - scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type], - type, hwmon_attributes[type]); + ret = scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, + nr_count[type], type, + hwmon_attributes[type]); + if (ret) + return ret; + *ptr_scmi_ci++ = scmi_hwmon_chan++; scmi_sensors->info[type] = @@ -333,8 +337,6 @@ static int scmi_hwmon_probe(struct scmi_ return PTR_ERR(hwdev); for (i = 0; i < nr_count_temp; i++) { - int ret; - sensor = *(scmi_sensors->info[hwmon_temp] + i); if (!sensor) continue;