]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
cifs: Validate content of WSL reparse point buffers
authorPali Rohár <pali@kernel.org>
Fri, 20 Sep 2024 23:29:33 +0000 (01:29 +0200)
committerSteve French <stfrench@microsoft.com>
Mon, 25 Nov 2024 20:50:32 +0000 (14:50 -0600)
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>
fs/smb/client/reparse.c

index 732b3b51128bd709c1559eb2be009ead4a83ffe2..e81d2d78ddb7c0637eda1c3de5e85b300f078925 100644 (file)
@@ -719,6 +719,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",