* FAILED: patch "[PATCH] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take" failed to apply to 6.6-stable tree
@ 2026-12-03 5:36 gregkh
2026-12-04 13:43 ` [PATCH 6.6.y] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2026-12-03 5:36 UTC (permalink / raw)
To: rosenp, linux; +Cc: stable
The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 69624d7d821ec7d3f9801e86acf555a8edc82f99
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120338-primal-sublevel-2691@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 69624d7d821ec7d3f9801e86acf555a8edc82f99 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 13 Nov 2026 22:20:23 -0800
Subject: [PATCH] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take
The fan_max module parameter is used without any range check, unlike
fan_mult. dell_smm_init_hwmon() allocates the nominal speed table with
devm_kmalloc_array(dev, data->i8k_fan_max + 1, ...)
and fan_max=4294967295 wraps the count to 0. devm_kmalloc() then
returns ZERO_SIZE_PTR, which the first successful nominal speed call
writes through.
Values above 255 are also meaningless: the fan state is passed to the
BIOS as fan | (speed << 8), so the higher bits end up in other parts of
the request. Large values that do not wrap still cost one SMM call per
state and fan while probing.
Fail probing if the maximum fan state does not fit in a byte, like the
existing check for fan_mult.
Fixes: 81474fc2fae9 ("i8k: Add support for configurable maximum fan speed value")
cc: stable@vger.kernel.org
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/6d3b86acf6713e9286e60ecf788582e840946238.1794633179.git.rosenp@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index 5ec487843faa..47c06376aa52 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -1248,6 +1248,12 @@ static int dell_smm_init_data(struct device *dev, const struct dell_smm_ops *ops
return -EINVAL;
}
data->i8k_fan_max = fan_max ? : I8K_FAN_HIGH;
+ /* The BIOS takes the fan state in a single byte */
+ if (data->i8k_fan_max > U8_MAX) {
+ dev_err(dev, "maximum fan state %u is too large (max %u)\n",
+ data->i8k_fan_max, U8_MAX);
+ return -EINVAL;
+ }
data->i8k_pwm_mult = DIV_ROUND_UP(255, data->i8k_fan_max);
return 0;
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 6.6.y] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take
2026-12-03 5:36 FAILED: patch "[PATCH] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take" failed to apply to 6.6-stable tree gregkh
@ 2026-12-04 13:43 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-12-04 13:43 UTC (permalink / raw)
To: stable; +Cc: Rosen Penev, Guenter Roeck, Sasha Levin
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 69624d7d821ec7d3f9801e86acf555a8edc82f99 ]
The fan_max module parameter is used without any range check, unlike
fan_mult. dell_smm_init_hwmon() allocates the nominal speed table with
devm_kmalloc_array(dev, data->i8k_fan_max + 1, ...)
and fan_max=4294967295 wraps the count to 0. devm_kmalloc() then
returns ZERO_SIZE_PTR, which the first successful nominal speed call
writes through.
Values above 255 are also meaningless: the fan state is passed to the
BIOS as fan | (speed << 8), so the higher bits end up in other parts of
the request. Large values that do not wrap still cost one SMM call per
state and fan while probing.
Fail probing if the maximum fan state does not fit in a byte, like the
existing check for fan_mult.
Fixes: 81474fc2fae9 ("i8k: Add support for configurable maximum fan speed value")
cc: stable@vger.kernel.org
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/6d3b86acf6713e9286e60ecf788582e840946238.1794633179.git.rosenp@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[ sashal: Placed the fan_max range check in dell_smm_probe() after the i8k_fan_max assignment, since dell_smm_init_data() doesn't exist here, and used dev_err(&pdev->dev, ...) instead of dev_err(dev, ...). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hwmon/dell-smm-hwmon.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index 39a5a7deabe46..d1ef93afb6a04 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -1408,6 +1408,12 @@ static int __init dell_smm_probe(struct platform_device *pdev)
/* All options must not be 0 */
data->i8k_fan_mult = fan_mult ? : I8K_FAN_MULT;
data->i8k_fan_max = fan_max ? : I8K_FAN_HIGH;
+ /* The BIOS takes the fan state in a single byte */
+ if (data->i8k_fan_max > U8_MAX) {
+ dev_err(&pdev->dev, "maximum fan state %u is too large (max %u)\n",
+ data->i8k_fan_max, U8_MAX);
+ return -EINVAL;
+ }
data->i8k_pwm_mult = DIV_ROUND_UP(255, data->i8k_fan_max);
fan_control = dmi_first_match(i8k_whitelist_fan_control);
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-04 13:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 5:36 FAILED: patch "[PATCH] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take" failed to apply to 6.6-stable tree gregkh
2026-12-04 13:43 ` [PATCH 6.6.y] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox