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=1796388222; b=HbpLyxfsSP1COA+J2fjABX8oKwvsaQ0ia++7TcU2Y3IvMHSUURV1Rd2m/7LHcevAYzLP fZKtxPrnaY7KH24HjnhT2c1FuFhP26zY6UWjUTTue4xpI+LERUPI22yI0C0mg5swuUnvN RnkSjKGMis2s6kWezGhpUP2cWgFEvDLhuoFb0xh6X0xS/rnW1QF3L9pTuy6N4jxxQUeUf VKIDIPgeZQRr/DHGDZWK7N2hDZS2h8gJOL+4RhPwKdFP+qH977x97NQZzrn279WIYz/8g G/ncxIyrQkFIKTPgPc9M4O27xFIz91nSwVRzuYXfMewxmwKXzcf3V+3+C71ezHBBy8w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388222; 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=aC/0ePaIGWMOzOCJrhoNJVKS1+6oFXvXVHo24Cuwea8=; b=X1L8/uvzaE82wUH0BuwPtSDl+PVW4xdJcowaBpdBJLm2xsfatCo8LuDdbbwiRn5t56Ul Wx6AblJIz4D60UbG8zY36anPkeY3HWWlDswyFTAKSChSLtSBMIkAFuPuWMRR/+Ak6QYJT 52xysZF2p+PbRGas2GfLZClp9nL3NejiSXgKanquEv5yhIwam/rQSMV9+jy0y44wEG284 ARs65iRt2do17SuK2CJlptZBLO29nMYuDZSf9UyvqxpHgKwVteDB3uKFclssxRGRV6Ug5 CQ8RIY0Yz13ZuJzt1G9KavAWNXn+Q3SKfqna1a1QVD4wnGngC+Fyrm5mlr+nHxsRxFw== 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=MGDiZHK9; 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 6C993606A322; Fri, 4 Dec 2026 12:43:42 +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=MGDiZHK9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA1731F000CE; Fri, 4 Dec 2026 12:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388222; bh=aC/0ePaIGWMOzOCJrhoNJVKS1+6oFXvXVHo24Cuwea8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MGDiZHK9liGi6uwgiALc87AZXr5XIHL3vjwSzr1rdLSI4TPAvSttXfomzDfXAV2Gd 1kfy3jEJ+BKzM217DwLXW6xPvYC9+kv92Dh92c2vhOGnsVPo4agZ+/zirdDhwukqxM Cv8+oGqsUYzgObCKCLl7EhZyTzRHkd929o61DKIM= 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.1 0530/1059] hwmon: (scmi) Check channel config allocation Date: Fri, 4 Dec 2026 19:01:01 +0900 Message-ID: <20261204100657.946757088@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: 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.1-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;