From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 787903446AD; Mon, 20 Apr 2026 16:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776700990; cv=none; b=RVp67JDXR8kbkUt2AuD5Hq6tc/geASXrt1XanOEnHiwsnUq17941tpPRIGykXi/KnZIYzYhvesU/qASPV5CzIv59g7Uo22uhLLc+PhuRayCk4keTxUDhiKO3IUnoOiWTw70/M1VZkBzCtwgrREQkiTbMMt+2XOVqBcNg6yR0Z5A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776700990; c=relaxed/simple; bh=ZhcLdB0UlHcntoI5C+GV++UwFk94xpd4HZQQ0v1V8hM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X5NfSRKU6+gxgzIfghNNJIdJFwFZF9/Os8CmrNGcDohOepZ7EGIjb4p868ARXH7gdm4TB1w/12NiVgBOnWDEgHJaHFOvwJt9VknE9AyvIUrVxAsW4zmJI2m3yVZXkLbGiJHNqpzHqxmOjvUP/B39JsQuEj2wHuUuK3QOPjyYLr4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UAk3rQJh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UAk3rQJh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B0B2C2BCB6; Mon, 20 Apr 2026 16:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776700990; bh=ZhcLdB0UlHcntoI5C+GV++UwFk94xpd4HZQQ0v1V8hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UAk3rQJhIDjMv2YIjVZboXJTmjFsCzwMlRanZBvNE1GT8YBk7Ag4ybNylnavQeeGa Zv2MIoXlCzm4a13Wq4t5iVhfC3YstvmleI3V9CeNaUa5dQH4r3g7P/3OP3GRQ/aRGD uSD0mPMM592ACscUXycDTmKe7oqlbk73W1tWCFvE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, stable , "Paulo Alcantara (Red Hat)" , Steve French Subject: [PATCH 6.18 137/198] smb: client: fix off-by-8 bounds check in check_wsl_eas() Date: Mon, 20 Apr 2026 17:41:56 +0200 Message-ID: <20260420153940.539666924@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153935.605963767@linuxfoundation.org> References: <20260420153935.605963767@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kroah-Hartman commit 3d8b9d06bd3ac4c6846f5498800b0f5f8062e53b upstream. The bounds check uses (u8 *)ea + nlen + 1 + vlen as the end of the EA name and value, but ea_data sits at offset sizeof(struct smb2_file_full_ea_info) = 8 from ea, not at offset 0. The strncmp() later reads ea->ea_data[0..nlen-1] and the value bytes follow at ea_data[nlen+1..nlen+vlen], so the actual end is ea->ea_data + nlen + 1 + vlen. Isn't pointer math fun? The earlier check (u8 *)ea > end - sizeof(*ea) only guarantees the 8-byte header is in bounds, but since the last EA is placed within 8 bytes of the end of the response, the name and value bytes are read past the end of iov. Fix this mess all up by using ea->ea_data as the base for the bounds check. An "untrusted" server can use this to leak up to 8 bytes of kernel heap into the EA name comparison and influence which WSL xattr the data is interpreted as. Cc: Ronnie Sahlberg Cc: Shyam Prasad N Cc: Tom Talpey Cc: Bharath SM Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Cc: stable Assisted-by: gregkh_clanker_t1000 Reviewed-by: Paulo Alcantara (Red Hat) Signed-off-by: Greg Kroah-Hartman Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/smb2inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/smb/client/smb2inode.c +++ b/fs/smb/client/smb2inode.c @@ -125,7 +125,7 @@ static int check_wsl_eas(struct kvec *rs nlen = ea->ea_name_length; vlen = le16_to_cpu(ea->ea_value_length); if (nlen != SMB2_WSL_XATTR_NAME_LEN || - (u8 *)ea + nlen + 1 + vlen > end) + (u8 *)ea->ea_data + nlen + 1 + vlen > end) return -EINVAL; switch (vlen) {