Skip to content

Commit bce4e7e

Browse files
committed
apparmor: reduce rcu_read_lock scope for aa_file_perm mediation
Now that the buffers allocation has changed and no longer needs the full mediation under an rcu_read_lock, reduce the rcu_read_lock scope to only where it is necessary. Fixes: df32333 ("apparmor: Use a memory pool instead per-CPU caches") Signed-off-by: John Johansen <[email protected]>
1 parent 8f21a62 commit bce4e7e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

security/apparmor/file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,8 @@ int aa_file_perm(const char *op, struct aa_label *label, struct file *file,
621621
fctx = file_ctx(file);
622622

623623
rcu_read_lock();
624-
flabel = rcu_dereference(fctx->label);
624+
flabel = aa_get_newest_label(rcu_dereference(fctx->label));
625+
rcu_read_unlock();
625626
AA_BUG(!flabel);
626627

627628
/* revalidate access, if task is unconfined, or the cached cred
@@ -646,8 +647,7 @@ int aa_file_perm(const char *op, struct aa_label *label, struct file *file,
646647
error = __file_sock_perm(op, label, flabel, file, request,
647648
denied);
648649
done:
649-
rcu_read_unlock();
650-
650+
aa_put_label(flabel);
651651
return error;
652652
}
653653

0 commit comments

Comments
 (0)