]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
92089f6026331baa8fa0993526e7a3af5b1bf3cc
[thirdparty/kernel/stable-queue.git] /
1 From 9186d472ee780fabf74424756c4c00545166157e Mon Sep 17 00:00:00 2001
2 From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
3 Date: Wed, 24 Nov 2021 15:08:19 +0300
4 Subject: fs/ntfs3: In function ntfs_set_acl_ex do not change inode->i_mode if called from function ntfs_init_acl
5
6 From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
7
8 commit 9186d472ee780fabf74424756c4c00545166157e upstream.
9
10 ntfs_init_acl sets mode. ntfs_init_acl calls ntfs_set_acl_ex.
11 ntfs_set_acl_ex must not change this mode.
12 Fixes xfstest generic/444
13 Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations")
14
15 Reviewed-by: Joe Perches <joe@perches.com>
16 Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 ---
19 fs/ntfs3/xattr.c | 13 +++++++------
20 1 file changed, 7 insertions(+), 6 deletions(-)
21
22 --- a/fs/ntfs3/xattr.c
23 +++ b/fs/ntfs3/xattr.c
24 @@ -541,7 +541,7 @@ struct posix_acl *ntfs_get_acl(struct in
25
26 static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
27 struct inode *inode, struct posix_acl *acl,
28 - int type)
29 + int type, bool init_acl)
30 {
31 const char *name;
32 size_t size, name_len;
33 @@ -554,8 +554,9 @@ static noinline int ntfs_set_acl_ex(stru
34
35 switch (type) {
36 case ACL_TYPE_ACCESS:
37 - if (acl) {
38 - umode_t mode = inode->i_mode;
39 + /* Do not change i_mode if we are in init_acl */
40 + if (acl && !init_acl) {
41 + umode_t mode;
42
43 err = posix_acl_update_mode(mnt_userns, inode, &mode,
44 &acl);
45 @@ -616,7 +617,7 @@ out:
46 int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
47 struct posix_acl *acl, int type)
48 {
49 - return ntfs_set_acl_ex(mnt_userns, inode, acl, type);
50 + return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false);
51 }
52
53 /*
54 @@ -636,7 +637,7 @@ int ntfs_init_acl(struct user_namespace
55
56 if (default_acl) {
57 err = ntfs_set_acl_ex(mnt_userns, inode, default_acl,
58 - ACL_TYPE_DEFAULT);
59 + ACL_TYPE_DEFAULT, true);
60 posix_acl_release(default_acl);
61 } else {
62 inode->i_default_acl = NULL;
63 @@ -647,7 +648,7 @@ int ntfs_init_acl(struct user_namespace
64 else {
65 if (!err)
66 err = ntfs_set_acl_ex(mnt_userns, inode, acl,
67 - ACL_TYPE_ACCESS);
68 + ACL_TYPE_ACCESS, true);
69 posix_acl_release(acl);
70 }
71