]> git.baikalelectronics.ru Git - kernel.git/commit
attr: add in_group_or_capable()
authorChristian Brauner <brauner@kernel.org>
Mon, 17 Oct 2022 15:06:34 +0000 (17:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Mar 2023 10:52:24 +0000 (11:52 +0100)
commitdfa5f11fa5ad8ed91df85c7d096b82fcb3205e61
tree237e771ee2830d84b5d814332f0ac68f821c822d
parent62a0b5b1c6aa60e8ab177073ce4e65e2d83bd933
attr: add in_group_or_capable()

commit 91b86ba27c1c3a38bfd2918c0cda81f85bc617de upstream.

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