attr: add in_group_or_capable()
stable inclusion from stable-v5.10.176 commit 24378d6f748649060f4d0c3eea8a1efe5bccfd1d category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I87BGI Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=24378d6f748649060f4d0c3eea8a1efe5bccfd1d -------------------------------- commit 11c2a870 upstream. [backported to 5.10.y, prior to idmapped mounts] In setattr_{copy,prepare}() we need to perform the same permission checks to determine whether we need to drop the setgid bit or not. Instead of open-coding it twice add a simple helper the encapsulates the logic. We will reuse this helpers to make dropping the setgid bit during write operations more consistent in a follow up patch. Reviewed-by:Amir Goldstein <amir73il@gmail.com> Signed-off-by:
Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by:
Amir Goldstein <amir73il@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
sanglipeng <sanglipeng1@jd.com>
Loading
Please sign in to comment