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 AD6AC2FD1B3; Mon, 20 Apr 2026 15:53:14 +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=1776700394; cv=none; b=uiCUn1LwR3I0vDyrdv85xgeEtZz9GmdDCpaTDiVH/lZRbCJT77t+L6qEklD4u7DDMPSAOJ8lKwt16N38b2vCPZgU5tkHmf/q5tF6rCvWfBzdG0INa1C0X31Uzl23GxKaK4FED6kNyIUG13CuG94pATQrfiC1BGX9lmgkE14v/xI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776700394; c=relaxed/simple; bh=ZFx+/6vyT9oO57nqY+rdh1WFRhVnjGOuSWjHUCnrJ3o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IZ3KRAAC/9dux6eflFrtzuSCH3308Tf9j2BrzidPVHybdWFlv+rCWIHZxRok8UXklRyQt4hZM5J5GEZOvqETbC0m1o7OQNl/VsLTJpG6Drb1OiwdWhRPtJ0Pc5p7VKscQ9ZAxVxr5vwLBmynz7NuAw7Aub1L4GfsEnWClYapZeQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nLpuQThr; 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="nLpuQThr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43E15C19425; Mon, 20 Apr 2026 15:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776700394; bh=ZFx+/6vyT9oO57nqY+rdh1WFRhVnjGOuSWjHUCnrJ3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nLpuQThrTXAVG92391D7KUgzPJnfyjGrJW6+N5zQPnPIa4ScsOiGgMPVC2PUaCE7U ri0Y3vhhwXB0O3m8peMkbNLzwgCCYFi1A2sIjPVL+e5dzfOXVVqBcNc09WHLZXOHIV TxfMSmYY0DRnnmLIRctgYY4yuWZxtU+kqrgr6LC4= 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.19 156/220] smb: client: fix off-by-8 bounds check in check_wsl_eas() Date: Mon, 20 Apr 2026 17:41:37 +0200 Message-ID: <20260420153939.644361730@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153934.013228280@linuxfoundation.org> References: <20260420153934.013228280@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.19-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) {