]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
attr: add in_group_or_capable()
authorAmir Goldstein <amir73il@gmail.com>
Sat, 18 Mar 2023 10:15:24 +0000 (12:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:30:07 +0000 (13:30 +0100)
commit24378d6f748649060f4d0c3eea8a1efe5bccfd1d
tree05624664d8617cc75323fe0aa83a79832da32db3
parent94ac142c19f1016283a1860b07de7fa555385d31
attr: add in_group_or_capable()

commit 11c2a8700cdcabf9b639b7204a1e38e2a0b6798e 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>
fs/attr.c
fs/inode.c
fs/internal.h