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 3065E3955C3; Tue, 12 May 2026 17:47:39 +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=1778608059; cv=none; b=dwE86LnYCvUM1bVRltXesFQusTWTvuQuHS+opDWtc9HXija0B4rPuqR0I9nlUtsE3xNWmsFYtFqDWazu8rh73jAbFKqviwYkT/ldNBw89zdmumwvxDUyCLC1zuCMWSr3VprPoFGiLN8lUPqMKXgVTyWvAG7WCiXwycWAOEv/vQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778608059; c=relaxed/simple; bh=3+hPr2N/Fc1up9ErTCzSEubhztzd0NwKCWCE5Jhsp8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pPFxa/u7++FeMY3rtX/ndfQorrnde1j86vHFV0qroQzf4to2Coy6ygtWzKUjug4nvtp8tmstr+WTJVt5B2u88A0Xw2QPZO2QhZAiaFI+vgwpIowN+c2/Qrt3itoLTPOZpPN7r0Ng7RBA6pYXHP59cIWaw7L1A3lz8bq7GAerKVw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZYD7YxsU; 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="ZYD7YxsU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A11F8C2BCC7; Tue, 12 May 2026 17:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778608059; bh=3+hPr2N/Fc1up9ErTCzSEubhztzd0NwKCWCE5Jhsp8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYD7YxsUhx5kINupU9zkvk4g1aZQEktQUs9rjKACqEXqcnpxVGnz/R1+NhGaCiWyF OiSBjD3uxc2hvRwt7f1z5+7b8i6I1ZhHR6SnKgn54Wm1yXuyENqL1f0r4I8dUtvtIV RXcrKmJ8dweBokAREGiR7voDiOc0XzeO5wCLVzbE= 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.12 138/206] smb/client: fix out-of-bounds read in symlink_data() Date: Tue, 12 May 2026 19:39:50 +0200 Message-ID: <20260512173935.783260377@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260512173932.810559588@linuxfoundation.org> References: <20260512173932.810559588@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.12-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)