FAILED: patch "[PATCH] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-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 <[email protected]>.
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.1.y
git checkout FETCH_HEAD
git cherry-pick -x 69624d7d821ec7d3f9801e86acf555a8edc82f99
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026120340-germless-unfold-0b35@gregkh' --subject-prefix 'PATCH 6.1.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 <[email protected]>
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.
drivers/hwmon/dell-smm-hwmon.c +6 -0
@@ -1248,6 +1248,12 @@ static int dell_smm_init_data(struct device *dev, const struct dell_smm_ops *opsreturn -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 ;