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=1796380955; b=rXQWCssTq8zy7AwKhlpihIvMaqDQ56oLnRVKWj2n1eQtNc5kL7a6bT2v85sgqW3wHJHR UXsc6hRk7vJT3CqVchKUmr5rfCFGhgr9JbYKmnGwxjvzF7VYnaplysRYg5KHVSDV6HXCY iSDLuJcXMfg9KZFjwZfCv4QUPIMefjdkgCE+a0Y1qH2FezHhA0BoUUI5AEyr6WmssI56L ady+TZzBntnLuxdVDNHJs41mAdv9O0MSGk8pGdDptmZOV8YzrWm8XEIyRw56KYpg+fP0T UoM4UYLuwrG/Vel+adXZGComqnZ+8TwBNAGMqA3t9tE1WYtn2MJhZiAFSxRMk/v2HmA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380955; 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=LLckUniUyM8rFfQD0Z4aHKVPtoxNgafdA/VMTT0I8VE=; b=5gvgjr9XAKwGU8Kr6vyTlg4YO3cK2o7edhqeSgf7a7tqTyxdZps8b0Uv6ZRyW29Wey21 8SzAez+eHU39MatQQ9RZqhuGHKlJn5kvdRIoeyIyPLBRXvUX8X826oM2DjhsfafXUpwtV y4osp6efdwfU1wVCMPI4oCptxbamRjmNvf3m4OkTJhnxRZxAmWXRvNlsfhYleyOe0ZF6c f6Ot/z/TmAl0FohflxInub1eoSWg3Oe724fF3WTwisF31YdZi40JbQvLCUq/WN6pguPh7 OK13jahd9ux166s3SWprq2TLQjR/hWqPCQOXcE7dwnzDVddLzlrPLQbZYaqQNMs6gfg== 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=Hnxv2LCV; 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 62DE7606A322; Fri, 4 Dec 2026 10:42:35 +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=Hnxv2LCV Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2D741F000C2; Fri, 4 Dec 2026 10:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380955; bh=LLckUniUyM8rFfQD0Z4aHKVPtoxNgafdA/VMTT0I8VE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Hnxv2LCVG7D2fyDB35IUVLDlhVNH3/8dBjT5WE1kboef+u8DVhO01mySu5RrgipsK SIC4OnHwKTvvRid7Ei/7IpDQWJ5od+0L1GcyFjTMNKBHJ375dVFlITBCZTMTr1uioq GpG0LPJmcBpJ8Q6ih8fsl7ylSkfa4CVcIXN5EnVc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rosen Penev , Guenter Roeck Subject: [PATCH 7.3 497/742] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take Date: Fri, 4 Dec 2026 19:06:01 +0900 Message-ID: <20261204100648.337172271@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 @@ -1248,6 +1248,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;