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 3292C303CB0; Fri, 15 May 2026 16:08:06 +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=1778861286; cv=none; b=u2+MhI/3qdISzB7KMuaGDiXuKUcn1PvKrhW0CrKGlhUGz78zdTFi0RFSedb1scdXo0qF4aaA08crIigiTlXOaX1hUdrRYv9CpHTG4PeGK4ew69p7H2YLr+ByXO/o8esEHiZnfT4OcykAQKHnPqN6M2VFAyeAa6QCjn65l99vkO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778861286; c=relaxed/simple; bh=bpwjBkl2m5UWhPC9jMwCOGEfbPNxALujq47+a1WVC0I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ppx2t+4lIsfasPSZicx86+mrc+bLDxqr3JSHlMiC/g+k5+eKHctKGVNCn6JR7DE6aPcJ5IH8SPyERvUk6SoldPXKcWIYh5IlKQ9vXyR2X2F6FojufVgujd0dppwJIWPqiBfmTk6C6ofSzABGBXXK69DlwUEJWsCVBJDdGJlqYrU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ne1B3wqg; 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="ne1B3wqg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBAFEC2BCB0; Fri, 15 May 2026 16:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778861286; bh=bpwjBkl2m5UWhPC9jMwCOGEfbPNxALujq47+a1WVC0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ne1B3wqg2xBNZRFAm6us86Nr7TdNKs3s9PPncTWOskS+4p6o87d09Y/1y+yaSWHpW n/mQUK1olI7tr+77KuhMsZCU7ZuQW2j71U9r+XCWXBq0jVXrIBPP4DJld4JQRxKZgA h+dYyzMCYu71SSYtmgS8GbIMBHeQ1GyL3Zydc6Ig= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stable@vger.kernel.org, Zisen Ye , ChenXiaoSong , Steve French Subject: [PATCH 6.6 270/474] smb/client: fix out-of-bounds read in symlink_data() Date: Fri, 15 May 2026 17:46:19 +0200 Message-ID: <20260515154720.843991498@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260515154715.053014143@linuxfoundation.org> References: <20260515154715.053014143@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: Zisen Ye commit d62b8d236fab503c6fec1d3e9a38bea71feaca20 upstream. Since smb2_check_message() returns success without length validation for the symlink error response, in symlink_data() it is possible for iov->iov_len to be smaller than sizeof(struct smb2_err_rsp). If the buffer only contains the base SMB2 header (64 bytes), accessing err->ErrorContextCount (at offset 66) or err->ByteCount later in symlink_data() will cause an out-of-bounds read. Link: https://lore.kernel.org/linux-cifs/297d8d9b-adf7-42fd-a1c2-5b1f230032bc@chenxiaosong.com/ Fixes: 76894f3e2f71 ("cifs: improve symlink handling for smb2+") Cc: Stable@vger.kernel.org Signed-off-by: Zisen Ye Reviewed-by: ChenXiaoSong Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/smb2misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/smb/client/smb2misc.c +++ b/fs/smb/client/smb2misc.c @@ -239,7 +239,8 @@ smb2_check_message(char *buf, unsigned i if (len != calc_len) { /* create failed on symlink */ if (command == SMB2_CREATE_HE && - shdr->Status == STATUS_STOPPED_ON_SYMLINK) + shdr->Status == STATUS_STOPPED_ON_SYMLINK && + len > calc_len) return 0; /* Windows 7 server returns 24 bytes more */ if (calc_len + 24 == len && command == SMB2_OPLOCK_BREAK_HE)