]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ksmbd: handle set/get info file for streamed file
authorNamjae Jeon <linkinjeon@kernel.org>
Fri, 13 Jun 2025 02:51:29 +0000 (11:51 +0900)
committerSteve French <stfrench@microsoft.com>
Tue, 17 Jun 2025 21:27:16 +0000 (16:27 -0500)
commit4ea0bb8aaedfad8e695429cda6bd1c8b0dad0844
treee5d64aa8749f319e14f38c5dc08fb737cbfd83df
parent7ac5b66acafcc9292fb935d7e03790f2b8b2dc0e
ksmbd: handle set/get info file for streamed file

The bug only appears when:
 - windows 11 copies a file that has an alternate data stream
 - streams_xattr is enabled on the share configuration.

Microsoft Edge adds a ZoneIdentifier data stream containing the URL
for files it downloads.

Another way to create a test file:
 - open cmd.exe
 - echo "hello from default data stream" > hello.txt
 - echo "hello again from ads" > hello.txt:ads.txt

If you open the file using notepad, we'll see the first message.
If you run "notepad hello.txt:ads.txt" in cmd.exe, we should see
the second message.

dir /s /r should least all streams for the file.

The truncation happens because the windows 11 client sends
a SetInfo/EndOfFile message on the ADS, but it is instead applied
on the main file, because we don't check fp->stream.

When receiving set/get info file for a stream file, Change to process
requests using stream position and size.
Truncate is unnecessary for stream files, so we skip
set_file_allocation_info and set_end_of_file_info operations.

Reported-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smb2pdu.c
fs/smb/server/vfs.c
fs/smb/server/vfs_cache.h