summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2024-09-21 01:29:33 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-22 12:54:21 -0700
commitb2bccc729b933a9f0f982ee05f7cf0c59a32311b (patch)
treebe064b8881e11787ec952a92e3fa1638534c2caf /fs
parent061ea46c56f6d62f1a216cdeaf44e6cecb9f6de4 (diff)
downloadlinux-b2bccc729b933a9f0f982ee05f7cf0c59a32311b.tar.gz
linux-b2bccc729b933a9f0f982ee05f7cf0c59a32311b.tar.bz2
linux-b2bccc729b933a9f0f982ee05f7cf0c59a32311b.zip
cifs: Validate content of WSL reparse point buffers
[ Upstream commit 1f48660667efb97c3cf70485c7e1977af718b48b ] WSL socket, fifo, char and block devices have empty reparse buffer. Validate the length of the reparse buffer. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Stable-dep-of: cad3fc0a4c8c ("cifs: Throw -EOPNOTSUPP error on unsupported reparse point type from parse_reparse_point()") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/client/reparse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
index e56a8df23fec..bd8808e50d12 100644
--- a/fs/smb/client/reparse.c
+++ b/fs/smb/client/reparse.c
@@ -651,6 +651,11 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
case IO_REPARSE_TAG_LX_FIFO:
case IO_REPARSE_TAG_LX_CHR:
case IO_REPARSE_TAG_LX_BLK:
+ if (le16_to_cpu(buf->ReparseDataLength) != 0) {
+ cifs_dbg(VFS, "srv returned malformed buffer for reparse point: 0x%08x\n",
+ le32_to_cpu(buf->ReparseTag));
+ return -EIO;
+ }
break;
default:
cifs_tcon_dbg(VFS | ONCE, "unhandled reparse tag: 0x%08x\n",