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=1796382429; b=NwB2UnDPrA8MtKRfyKcFz4RK3m84TCueLfXA5guRXKB/NYFYy+xrRiBeWvvT+q51MV/L W/NrHFfZewg1Cx6ZkrLmSwxzqMsSPcdWY4FC2zO38YrczHLWcaxLaRboNoRvyRc7Ng3Pt VghaUrCP72twwuj9zoNSx/ivKluNWJjkfZQXQNtbZpADotz+PPzX8Evdpx8/sqjSoAPis MDmdOLjxeryaYRQdDmAus1BD356za7B6nBhXpsA7dFv81r0gx3z/kiAZwIGeOpv0Xqpk0 GPGppKTHi9g08r3GTRjUiVlqDPXTXI0D88aa6b0mNNSAb8h/BScFc2LxBKxv9otEKcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382429; 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=tpUVyMR4ZqGist0u1JG6ZyYNEFsZQ22FpyLHzxd/Fmw=; b=skjuo8EcJqibGd+Pz5/8ol26qQpbz2ncMOZsyX9a9ze78qxG9CYBdqOty31/1ZZYQNle 71c9qWzTVYvOrqLrurzYrGFFnXbWzj4hJxXIdnCusab3gLh6qpVeab+Kvt0Ocp+l3rmwE +CSQgL0LUba+G+C4aR0hzSI4Awhfs52xEdRu2yYnFY2cO2onv5gzj4QEA2UOZvImbQaP9 xivG7K6znKpv33ZzLZAQEwtcL2Dp/LE+KFkzUgiGworM/0+RWi9Ev0haaj+9T401US4CM UDW7pMq7w9c3ZKWUoNbSaQIzROxNfY8ozHkbgLsSFcv8FnE/FdSG177QBK6TqmFy7gg== 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=da2vMQDi; 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 03EC4606A330; Fri, 4 Dec 2026 11:07:09 +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=da2vMQDi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F8A11F0092C; Fri, 4 Dec 2026 11:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382428; bh=tpUVyMR4ZqGist0u1JG6ZyYNEFsZQ22FpyLHzxd/Fmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=da2vMQDihbX08LV4ta744XbULy8hOlf/+JQQ/RN72bCHS+VPlKV3rPIyzg9OU7+1y BIJkjrH5/1564Ngz415FmpNOGAcN0OZrbsz/lD1jo7JZQdWI1K0SPGBr/RcaTWXRHh AENWec/Q6dDXnyZWcB5uJPcGZE8h2GuCzjL0pN1Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rosen Penev , Guenter Roeck Subject: [PATCH 6.18 448/703] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take Date: Fri, 4 Dec 2026 19:05:47 +0900 Message-ID: <20261204100639.713516935@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rosen Penev commit 69624d7d821ec7d3f9801e86acf555a8edc82f99 upstream. 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 Link: https://patch.msgid.link/6d3b86acf6713e9286e60ecf788582e840946238.1794633179.git.rosenp@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/dell-smm-hwmon.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -1263,6 +1263,12 @@ static int dell_smm_init_data(struct dev 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;