lkml.org 
[lkml]   [2024]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ext4: Don't reduce symlink i_mode by umask if no ACL support
Date
If CONFIG_EXT4_FS_POSIX_ACL=n then the fallback version of ext4_init_acl()
will mask off the umask bits from the new inode's i_mode. This should not
be done if the inode is a symlink. If CONFIG_EXT4_FS_POSIX_ACL=y, then we
go through posix_acl_create() instead which does the right thing with
symlinks.

Fix this by making the fallback version of ext4_init_acl() do nothing if
inode is a symlink.

Fixes: 484fd6c1de13 ("ext4: apply umask if ACL support is disabled")
Signed-off-by: David Howells <dhowells@redhat.com>
---
fs/ext4/acl.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/acl.h b/fs/ext4/acl.h
index ef4c19e5f570..566625286442 100644
--- a/fs/ext4/acl.h
+++ b/fs/ext4/acl.h
@@ -71,7 +71,8 @@ ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
/* usually, the umask is applied by posix_acl_create(), but if
ext4 ACL support is disabled at compile time, we need to do
it here, because posix_acl_create() will never be called */
- inode->i_mode &= ~current_umask();
+ if (!S_ISLNK(inode->i_mode))
+ inode->i_mode &= ~current_umask();

return 0;
}

\
 
 \ /
  Last update: 2024-05-09 15:41    [W:0.052 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site