]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ntfs: fix mmap_prepare writable check for shared mappings
authorNamjae Jeon <linkinjeon@kernel.org>
Mon, 20 Apr 2026 23:13:57 +0000 (08:13 +0900)
committerNamjae Jeon <linkinjeon@kernel.org>
Wed, 22 Apr 2026 09:33:15 +0000 (18:33 +0900)
commit6e0152c75d70725add4cef3b1cb10abc6efa6ad9
treebf308b992425318ce068c22bdff131cef63f6005
parent660b982305cebd242df52fe87adf6b203a12f9be
ntfs: fix mmap_prepare writable check for shared mappings

Linus pointed out that checking only VMA_WRITE_BIT is incorrect.
Private writable mappings (MAP_PRIVATE) set VM_WRITE but do not
write back to the filesystem. Also, mappings that can become
writable via mprotect() (VM_MAYWRITE) must be handled.

Use vma_desc_test_all(VMA_SHARED_BIT, VMA_MAYWRITE_BIT) instead,
which matches what other filesystems do.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/ntfs/file.c