[apparmor] [PATCH 2/2] apparmor: use adaptive_current_label_crit_section helper in common_file_perm

Ryan Lee ryan.lee at canonical.com
Tue Jan 20 19:30:48 UTC 2026


common_file_perm can be called from both non-atomic and atomic contexts,
so select the atomic or non-atomic version accordingly.

Signed-off-by: Ryan Lee <ryan.lee at canonical.com>
---
 security/apparmor/lsm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index a87cd60ed206..834f91cb3278 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -531,9 +531,9 @@ static int common_file_perm(const char *op, struct file *file, u32 mask,
 	if (unlikely(file->f_path.dentry == aa_null.dentry))
 		return -EACCES;
 
-	label = __begin_current_label_crit_section(&needput);
+	label = begin_adaptive_current_label_crit_section(&needput, in_atomic);
 	error = aa_file_perm(op, current_cred(), label, file, mask, in_atomic);
-	__end_current_label_crit_section(label, needput);
+	end_adaptive_current_label_crit_section(label, needput, in_atomic);
 
 	return error;
 }
-- 
2.43.0




More information about the AppArmor mailing list