2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-29 07:34:06 +08:00

fs/ntfs3: Pass flags to ntfs_set_ea in ntfs_set_acl_ex

In case of removing of xattr there must be XATTR_REPLACE flag and
zero length. We already check XATTR_REPLACE in ntfs_set_ea, so
now we pass XATTR_REPLACE to ntfs_set_ea.

Reviewed-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
Konstantin Komarov 2021-09-22 18:33:38 +03:00
parent 0bd5fdb811
commit 398c35f4d7
No known key found for this signature in database
GPG Key ID: A9B0331F832407B6

View File

@ -549,6 +549,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
size_t size, name_len;
void *value = NULL;
int err = 0;
int flags;
if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
@ -591,20 +592,24 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
}
if (!acl) {
/* Remove xattr if it can be presented via mode. */
size = 0;
value = NULL;
flags = XATTR_REPLACE;
} else {
size = posix_acl_xattr_size(acl->a_count);
value = kmalloc(size, GFP_NOFS);
if (!value)
return -ENOMEM;
err = posix_acl_to_xattr(mnt_userns, acl, value, size);
if (err < 0)
goto out;
flags = 0;
}
err = ntfs_set_ea(inode, name, name_len, value, size, 0, locked);
err = ntfs_set_ea(inode, name, name_len, value, size, flags, locked);
if (err == -ENODATA && !size)
err = 0; /* Removing non existed xattr. */
if (!err)
set_cached_acl(inode, type, acl);