From 86a44e9067c95083d5dbf5a140e3f4560e5af1ca
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 15 Oct 2021 09:58:11 -0400
Subject: [Backport 86a44e9067c9] Merge tag 'ntfs3_for_5.15' of git://github.com/Paragon-Software-Group/linux-ntfs3
Pull ntfs3 fixes from Konstantin Komarov:
"Use the new api for mounting as requested by Christoph.
Also fixed:
- some memory leaks and panic
- xfstests (tested on x86_64) generic/016 generic/021 generic/022
generic/041 generic/274 generic/423
- some typos, wrong returned error codes, dead code, etc"
* tag 'ntfs3_for_5.15' of git://github.com/Paragon-Software-Group/linux-ntfs3: (70 commits)
src: Check for NULL pointers in ni_try_remove_attr_list
src: Refactor ntfs_read_mft
src: Refactor ni_parse_reparse
src: Refactor ntfs_create_inode
src: Refactor ntfs_readlink_hlp
src: Rework ntfs_utf16_to_nls
src: Fix memory leak if fill_super failed
src: Keep prealloc for all types of files
src: Remove unnecessary functions
src: Forbid FALLOC_FL_PUNCH_HOLE for normal files
src: Refactoring of ntfs_set_ea
src: Remove locked argument in ntfs_set_ea
src: Use available posix_acl_release instead of ntfs_posix_acl_release
src: Check for NULL if ATTR_EA_INFO is incorrect
src: Refactoring of ntfs_init_from_boot
src: Reject mount if boot's cluster size < media sector size
src: Refactoring lock in ntfs_init_acl
src: Change posix_acl_equiv_mode to posix_acl_update_mode
src: Pass flags to ntfs_set_ea in ntfs_set_acl_ex
src: Refactor ntfs_get_acl_ex for better readability
...
diff --git a/src/ntfs_fs.h b/src/ntfs_fs.h
index e95d93c683ed9852a1b941c3ac8585af0b925f7f..8aaec7e0804efaa4b66727bf0d7360f68abba8c0 100644
--- a/src/ntfs_fs.h
+++ b/src/ntfs_fs.h
@@ -836,7 +836,7 @@ int ntfs_cmp_names_cpu(const struct cpu_str *uni1, const struct le_str *uni2,
/* globals from xattr.c */
#ifdef CONFIG_NTFS3_FS_POSIX_ACL
-struct posix_acl *ntfs_get_acl(struct inode *inode, int type);
+struct posix_acl *ntfs_get_acl(struct inode *inode, int type, bool rcu);
int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type);
int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
diff --git a/src/xattr.c b/src/xattr.c
index 2143099cffdf3a5377d964bd36463ea8f4af9c87..afd0ddad826ff49f661ce758bcbecec46921fd1c 100644
--- a/src/xattr.c
+++ b/src/xattr.c
@@ -530,8 +530,11 @@ static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns,
/*
* ntfs_get_acl - inode_operations::get_acl
*/
-struct posix_acl *ntfs_get_acl(struct inode *inode, int type)
+struct posix_acl *ntfs_get_acl(struct inode *inode, int type, bool rcu)
{
+ if (rcu)
+ return ERR_PTR(-ECHILD);
+
/* TODO: init_user_ns? */
return ntfs_get_acl_ex(&init_user_ns, inode, type, 0);
}