[PATCH 1/2] fs/ntfs3: clear FILE_ATTRIBUTE_READONLY bit when argument 'mode' contains write permission
From: Zhenyan Wang
Date: Sun Sep 27 2026 - 14:07:25 EST
When creating a subdirectory, ntfs3 inherits the parent's
FILE_ATTRIBUTE_READONLY bit unconditionally, which means if the parent
is readonly, the child is readonly by default.
When argument 'mode' does not contain write permission, ntfs3 sets this
bit to 1. However, when mode contains write permission, it does not clear
this bit.
Fix this by clearing FILE_ATTRIBUTE_READONLY when mode contains write
permission.
Signed-off-by: Zhenyan Wang <maximwang110@xxxxxxxxx>
---
fs/ntfs3/inode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 0c9bd66..6717563 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -1273,6 +1273,8 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
if (!(mode & 0222))
fa |= FILE_ATTRIBUTE_READONLY;
+ else
+ fa &= ~FILE_ATTRIBUTE_READONLY;
new_de = kzalloc(PATH_MAX, GFP_KERNEL);
if (!new_de) {
--
2.53.0