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 BF08C336896; Mon, 20 Apr 2026 15:43:59 +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=1776699839; cv=none; b=TnQxPMF6t1xWR/i/9Elvt4GEPbG5KwNbOpHKOACiiXNB66zsNLVRfdFNB1ci+Bme1m8y0Fs8X5O+nZctxAa0WR5tFGVPXQqrxZlR4VrLoLbH2qpIcG2SGMXhnvkOZ1gATqT08zhUWzbXEq27P4JUimxaH2a3ydyyejxC8B1UrnQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776699839; c=relaxed/simple; bh=f8fVRrrYpvo0HnSywK8N4l4B+K/PGf2IQBs5i6352dk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f6r/ts4HdInJUpx0GNf5hcIAVxQnbM0Nmcox4I0IEkjsYHj+UpCsy3zy91+J2CmuyjmFFT4q0YHhnJdhKDjKMYcIom0UvVNSVx8/5YmVrWu1X9bwDUXXAQ460COKEzuO0OszMQHuNXRXnUT/yN/1oGHFrKHncIy0ajZOLnQJJ5E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=scxF4pfB; 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="scxF4pfB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44D43C2BCB6; Mon, 20 Apr 2026 15:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776699839; bh=f8fVRrrYpvo0HnSywK8N4l4B+K/PGf2IQBs5i6352dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scxF4pfB54WRQfu877aiY/sSDGG/mfan9V6GJKrm3hnWG/Ln7UNSsJwKxqrKixlyl 42qRyHTwBUOD1z2xrkXPHgwsL1621Kf658dHj7E+oSVuVouMUoeo4sIZd3U/ksdi5W PAQVEHBQx0LUzwlsGLLqYoEAYY7qbj6gCypCddFk= 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 7.0 18/76] smb: client: fix off-by-8 bounds check in check_wsl_eas() Date: Mon, 20 Apr 2026 17:41:29 +0200 Message-ID: <20260420153911.485780146@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153910.810034134@linuxfoundation.org> References: <20260420153910.810034134@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 7.0-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 @@ -128,7 +128,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) {