fs: Export in_group_or_capable()
Subsystems (3)
PATCH 1/3 fs: Export in_group_or_capable()
From: Youling Tang <[email protected]>
Export in_group_or_capable() as a VFS helper function.
--- fs/attr.c | 2 -- fs/inode.c | 1 + include/linux/fs.h | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-)
fs/attr.c +0 -2
@@ -17,8 +17,6 @@#include <linux/filelock.h> #include <linux/security.h> -#include "internal.h" -/** * setattr_should_drop_sgid - determine whether the setgid bit needs to be * removed
fs/inode.c +1 -0
@@ -2538,6 +2538,7 @@ bool in_group_or_capable(struct mnt_idmap *idmap,return true;return false; } +EXPORT_SYMBOL (in_group_or_capable);/** * mode_strip_sgid - handle the sgid bit for non-directories
include/linux/fs.h +2 -0
@@ -1926,6 +1926,8 @@ void inode_init_owner(struct mnt_idmap *idmap, struct inode *inode,extern bool may_open_dev (const struct path *path);umode_t mode_strip_sgid (struct mnt_idmap *idmap,const struct inode *dir,umode_t mode); +bool in_group_or_capable (struct mnt_idmap *idmap, +const struct inode *inode,vfsgid_t vfsgid);/* * This is the "filldir" function type, used by readdir() to let
Signature · 1 line
2.34.1
PATCH 2/3 f2fs: Use in_group_or_capable() helper
From: Youling Tang <[email protected]>
Use the in_group_or_capable() helper function to simplify the code.
--- fs/f2fs/acl.c | 3 +-- fs/f2fs/file.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-)
fs/f2fs/acl.c +1 -2
@@ -219,8 +219,7 @@ static int f2fs_acl_update_mode(struct mnt_idmap *idmap,return error;if (error ==0 ) *acl =NULL ; -if (!vfsgid_in_group_p (i_gid_into_vfsgid (idmap, inode)) && - !capable_wrt_inode_uidgid (idmap, inode,CAP_FSETID )) +if (!in_group_or_capable (idmap, inode,i_gid_into_vfsgid (idmap, inode))) mode &= ~S_ISGID ; *mode_p = mode;return 0 ;
fs/f2fs/file.c +1 -3
@@ -923,10 +923,8 @@ static void __setattr_copy(struct mnt_idmap *idmap,inode_set_ctime_to_ts (inode, attr->ia_ctime);if (ia_valid &ATTR_MODE ) {umode_t mode = attr->ia_mode; -vfsgid_t vfsgid =i_gid_into_vfsgid (idmap, inode); -if (!vfsgid_in_group_p (vfsgid) && - !capable_wrt_inode_uidgid (idmap, inode,CAP_FSETID )) +if (!in_group_or_capable (idmap, inode,i_gid_into_vfsgid (idmap, inode))) mode &= ~S_ISGID ;set_acl_inode (inode, mode); }
Signature · 1 line
2.34.1
PATCH 3/3 fuse: Use in_group_or_capable() helper
In reply to Youling TangFrom: Youling Tang <[email protected]>
Use the in_group_or_capable() helper function to simplify the code.
--- fs/fuse/acl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fuse/acl.c +2 -2
@@ -146,8 +146,8 @@ int fuse_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,* be stripped. */ if (fc->posix_acl && - !vfsgid_in_group_p (i_gid_into_vfsgid (&nop_mnt_idmap, inode)) && - !capable_wrt_inode_uidgid (&nop_mnt_idmap, inode,CAP_FSETID )) + !in_group_or_capable (&nop_mnt_idmap, inode, +i_gid_into_vfsgid (&nop_mnt_idmap, inode))) extra_flags |=FUSE_SETXATTR_ACL_KILL_SGID ; ret =fuse_setxattr (inode, name, value, size,0 , extra_flags);
Signature · 1 line
2.34.1
Quoted 3 lines · Youling Tang
Export
in_group_or_capable()as a VFS helper function.
This makes sense to me.
---
Applied to the vfs.misc branch of the vfs/vfs.git tree. Patches in the vfs.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.misc
[1/3] fs: Export in_group_or_capable()
https://git.kernel.org/vfs/vfs/c/daf0f1ce3585 [2/3] f2fs: Use in_group_or_capable() helper https://git.kernel.org/vfs/vfs/c/29a76d8b349b [3/3] fuse: Use in_group_or_capable() helper https://git.kernel.org/vfs/vfs/c/d128e6b878ac
This series was applied to jaegeuk/f2fs.git (dev) by Christian Brauner <[email protected]>:
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Christian Brauner <[email protected]>:
Quoted 10 lines · On Thu, 20 Jun 2024 11:23:33 +0800 you wrote:
From: Youling Tang <[email protected]>
Export
in_group_or_capable()as a VFS helper function.Signed-off-by Youling Tang <[email protected]>--- fs/attr.c | 2 -- fs/inode.c | 1 + include/linux/fs.h | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-)
Here is the summary with links:
- [f2fs-dev,1/3] fs: Export in_group_or_capable()
https://git.kernel.org/jaegeuk/f2fs/c/9b6a14f08b48 - [f2fs-dev,2/3] f2fs: Use in_group_or_capable() helper https://git.kernel.org/jaegeuk/f2fs/c/8444ee22adb0 - [f2fs-dev,3/3] fuse: Use in_group_or_capable() helper https://git.kernel.org/jaegeuk/f2fs/c/153216cf7bd5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html