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=1796383843; b=K2TEy87W0SUKbqFMY6JEvUVIaPW3Bl69bH5a833WhX94v7d5gfcc+TanapA1IiX/bPGX v6wCegN0HbiACOM2WBYsUmvS8NrhHfRkDbcSepZI+gcbVlrEVo6vEtwne/TemwWcwshoJ CA5xD0IEoiuQascVl6KUthxFIZ7LlE1qSQHndQbSKQpLx3+wcois0xYg05/ULIYKXlKzr cMOWcA9QFMST4/DjBZkqVp8/dpCGAi2LCMxnGCrp7AqKXQOKnwhROY8B4lOC9yequa2VG QutyFjLYkEqhajGy8i4PyeKDpr7Px8d9/oRGnpKL0Z9LNPTNYPW6s7xm9r7FVvTqYKQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383843; 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=BTSWwz2m4JiJ5U971Q2e6a60M0cOsOl9GfPAUb37VHs=; b=wTF/Agr7k4+derrFSVURk6EUMhNbJkiByQ9BJF/37R7yOGx5wgtOCqwWEbssUh/Wz9wI hVzs6x7vcd1SdPhuryhcnU30R2JMcPHkyKJPIHBi7aE1Brv+ZJA/Lct4KXkIuV4k2TpcX FOlUoirhYmsyyy0jMvS5o77cQG38HfZ/BPP792ujrJMfiPeqRyN+0V95pLfZtU2L31GKU +80gXAGS7mNgk3V+OclbjyD9j21WHZfIUSeq3iK8gN1R7KfWczzy7s12farCBkeDHVef4 4kiwq55E4cxvi7RLReyRFNEqWhF6U7MpWp8+gcRi8MkpXH1KU1nn/swy8Ee0Lr94BfQ== 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=HR0RtYny; 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 5B2E5606A322; Fri, 4 Dec 2026 11:30:43 +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=HR0RtYny Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBAB41F000CE; Fri, 4 Dec 2026 11:30:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383843; bh=BTSWwz2m4JiJ5U971Q2e6a60M0cOsOl9GfPAUb37VHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HR0RtYnyJZ/UvZSgbN08iDfEYcBtJiC4IexaZhrMbGOM09GTZGnSD7Mu8bo5HhRvJ P0C7VLOQk+rThb7TI7casLxMKB5QsqJ67nNr/1EjwDZ/Oqpb97ugnYFOuEs90dE6MZ JuGBXsG/WmL1RXM+5mARmPJEsUznZi3MfhypVBMg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rosen Penev , Guenter Roeck Subject: [PATCH 6.12 391/555] hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take Date: Fri, 4 Dec 2026 19:07:14 +0900 Message-ID: <20261204100624.598651256@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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 @@ -1213,6 +1213,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;