summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorRyan Lee <ryan.lee@canonical.com>2026-01-07 11:47:02 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-02-26 14:59:41 -0800
commit7757757908e0326fe73a91b650b0b5b872cfc593 (patch)
tree316bc666cb6359fddf898baaf56299999e8b3c99 /security
parentf3cb5e58a65d53cdb9456d19dc69af82f89a0d7a (diff)
apparmor: account for in_atomic removal in common_file_perm
[ Upstream commit 9b829c0aa96e9385b1e9a308d3eb054b95fbeda2 ] If we are not in an atomic context in common_file_perm, then we don't have to use the atomic versions, resulting in improved performance outside of atomic contexts. Signed-off-by: Ryan Lee <ryan.lee@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com> Stable-dep-of: 4a134723f9f1 ("apparmor: move check for aa_null file to cover all cases") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/lsm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 4e44bd5bf1d9..5fc99fe8d38a 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -523,15 +523,14 @@ static int common_file_perm(const char *op, struct file *file, u32 mask)
{
struct aa_label *label;
int error = 0;
- bool needput;
/* don't reaudit files closed during inheritance */
if (unlikely(file->f_path.dentry == aa_null.dentry))
return -EACCES;
- label = __begin_current_label_crit_section(&needput);
+ label = begin_current_label_crit_section();
error = aa_file_perm(op, current_cred(), label, file, mask, false);
- __end_current_label_crit_section(label, needput);
+ end_current_label_crit_section(label);
return error;
}