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 CCE2C38C2A0; Tue, 21 Jul 2026 20:49:37 +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=1784666978; cv=none; b=RWfBQFH2Jq8SluyuZ2BThQZjd9fz4fb36M7O/KjroqaEhogp6n8D0ULbotvrZeOjq7XbHrs/hjnIfkR9ASuhRSSOszI7XilC9xeDbz/Ono29pG8P6jbo4QJf+43OUvbyZ0ew4JDIpWk3CdmB1BsYBDHBI8wh25ePdq7J4IdzW7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784666978; c=relaxed/simple; bh=h4jSAmDxB26BLr/a2RLy8YGiuqyIryh8ZTlMg127FFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QVou271N6XQnPAEdfd2l0degz2dWxaD6Z+00K3qGuMCYjbg023LaqP7C5HaVm/7i9f3HASq1vrDcdzEa0Xp+daanhmWSGaSzrvWJ1taiq7ZW064tyZKyRBmfNdDKPx4KvQd1sukyHFTpZbMG4fucHpiK6NFnkCG5p/w3vgGIDlE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TYnGP0eB; 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="TYnGP0eB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E9E41F000E9; Tue, 21 Jul 2026 20:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784666977; bh=U5QYxUt1v3Vc/Ks+5NmI5d+L+QI6k39JOCJW5gGMalA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TYnGP0eBsuNFkokBZE9XU8/RbIG3N2Qu/MgxIxHpUkxRNCJtPLvuFFXYeYZcIIdAP jRROtXBdkGOyRcnHlofI5w/I9tuLRFJixq4SGC8Ip0dxl7NZXZoe8TSkrRg2xje20p RZ0hVSZbTCzjkmSGN8nMwntmkOixzLqSa4QJzcso= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guangshuo Li , Steve French , Sasha Levin Subject: [PATCH 6.6 0888/1266] smb: client: fix overflow in passthrough ioctl bounds check Date: Tue, 21 Jul 2026 17:22:05 +0200 Message-ID: <20260721152501.720261969@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guangshuo Li [ Upstream commit a4f27ad055392fa164f5649e89a3637b033c5fcc ] smb2_ioctl_query_info() validates the PASSTHRU_FSCTL response payload before copying it to userspace. The payload offset and length both come from 32-bit fields. The bounds check currently adds OutputOffset and qi.input_buffer_length directly, so the addition can wrap in 32-bit arithmetic before the result is compared against the response buffer length. A malicious server can use a large OutputOffset and a small OutputCount to make the wrapped sum pass the bounds check. The later copy_to_user() then reads from io_rsp + OutputOffset, outside the response buffer. Use size_add() for the offset plus length check so overflow is treated as out of bounds. Fixes: 2b1116bbe898 ("CIFS: Use common error handling code in smb2_ioctl_query_info()") Signed-off-by: Guangshuo Li Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/smb/client/smb2ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 084804bab5cfc7..8d152c3a24481d 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -1728,8 +1728,8 @@ smb2_ioctl_query_info(const unsigned int xid, if (le32_to_cpu(io_rsp->OutputCount) < qi.input_buffer_length) qi.input_buffer_length = le32_to_cpu(io_rsp->OutputCount); if (qi.input_buffer_length > 0 && - le32_to_cpu(io_rsp->OutputOffset) + qi.input_buffer_length - > rsp_iov[1].iov_len) { + size_add(le32_to_cpu(io_rsp->OutputOffset), + qi.input_buffer_length) > rsp_iov[1].iov_len) { rc = -EFAULT; goto out; } -- 2.53.0