From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 460913C1961; Sat, 30 May 2026 18:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780164856; cv=none; b=q45fisFJlzz2V3oF7+Rw+vrAT3gI/oaCzGCR0gDB5En8QFhCey+SDhn4VtZx7NM5BflFU8Dh2V5QUzfgTij4hGODKBhok6d5HnfUOc225NxBDq0pjG9ljDhatIEVqfNeYBGbnUn3C9A3ZMH2ceiuY8vLfOZj5yWFxoeYYD+p6uc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780164856; c=relaxed/simple; bh=ytb0OnppV+hVR4NOlPn1pUuoEb10+xrWJ3UT03KGJN0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F4xaiR7piJZ7G0bT/ZvNg/OsXbxjbkTDnX6jukrtqy5+T92S3vD6n3ObvjHfS0EUd5d8fDvloiguBIrrDY8zNvTjg8FL0S5feiMU/k7s4srrn900RtlcSZ8zriBaau0szCwvqjoaco8CyGu4N3CzJ9eG8LB7SoOyNpJYZuO27vo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zLGL2nq9; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zLGL2nq9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 914651F00893; Sat, 30 May 2026 18:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780164855; bh=ze6nqYumVDnvARo+1QHebO5CVUNh60loEMBpBc3RzU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zLGL2nq9P/1aXb17sK6mIMCLgT151GGiXZAPBBOxrfgMI1TUQx050YDYO3F05Q7uA K2fZSlw5d2MA/Ea3WSjVyMCO9rxYiVe7rhHvbHewZajsJLFFc3Le4RFxQqJ9Oi9ptm I7d2CQTTc9Adz+kyu4/xQs75C4mnQ1q0qn3yGCtk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdurrahman Hussain , Guenter Roeck Subject: [PATCH 5.15 679/776] hwmon: (pmbus/adm1266) widen blackbox-info buffer to I2C_SMBUS_BLOCK_MAX Date: Sat, 30 May 2026 18:06:33 +0200 Message-ID: <20260530160257.414745043@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdurrahman Hussain commit eee213daa1e1b402eb631bcd1b8c5aa340a6b081 upstream. adm1266_nvmem_read_blackbox() declares a 5-byte stack buffer and passes it to i2c_smbus_read_block_data() to retrieve the 4-byte BLACKBOX_INFO response. i2c_smbus_read_block_data() does not honour caller buffer sizes -- it memcpy()s data.block[0] bytes from the SMBus transaction (where data.block[0] is the length byte returned by the slave device, up to I2C_SMBUS_BLOCK_MAX = 32): memcpy(values, &data.block[1], data.block[0]); If the device returns any block length above 5, the call overflows the caller's 5-byte stack buffer before the post-call if (ret != 4) return -EIO; check has a chance to reject the response. Widen the local buffer to I2C_SMBUS_BLOCK_MAX so the helper has room for any well-formed SMBus block response, matching the convention used by the other i2c_smbus_read_block_data() callers in this driver. Fixes: 15609d189302 ("hwmon: (pmbus/adm1266) read blackbox") Cc: stable@vger.kernel.org Signed-off-by: Abdurrahman Hussain Link: https://lore.kernel.org/r/20260515-adm1266-fixes-v1-2-1c1ea1349cfe@nexthop.ai Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/pmbus/adm1266.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -351,7 +351,7 @@ static int adm1266_nvmem_read_blackbox(s { int record_count; char index; - u8 buf[5]; + u8 buf[I2C_SMBUS_BLOCK_MAX]; int ret; ret = i2c_smbus_read_block_data(data->client, ADM1266_BLACKBOX_INFO, buf);