summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--security/apparmor/lsm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 1246115b7435..f7b2d4bb1d97 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -1095,10 +1095,14 @@ static int apparmor_socket_create(int family, int type, int protocol, int kern)
AA_BUG(in_interrupt());
+ if (kern)
+ return 0;
+
label = begin_current_label_crit_section();
- if (!(kern || unconfined(label)))
+ if (!unconfined(label)) {
error = aa_af_perm(current_cred(), label, OP_CREATE,
AA_MAY_CREATE, family, type, protocol);
+ }
end_current_label_crit_section(label);
return error;