]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - security/selinux/selinuxfs.c
V4L/DVB (9450): Code Review: #4 Consolidate configurations
[linux-2.6-omap-h63xx.git] / security / selinux / selinuxfs.c
index 69c9dccc8cf0a116beecd3b093950f5c9a33b791..c86303638235f2633eaff9c5426eed950517f785 100644 (file)
@@ -95,13 +95,18 @@ extern void selnl_notify_setenforce(int val);
 static int task_has_security(struct task_struct *tsk,
                             u32 perms)
 {
-       struct task_security_struct *tsec;
-
-       tsec = tsk->security;
+       const struct task_security_struct *tsec;
+       u32 sid = 0;
+
+       rcu_read_lock();
+       tsec = __task_cred(tsk)->security;
+       if (tsec)
+               sid = tsec->sid;
+       rcu_read_unlock();
        if (!tsec)
                return -EACCES;
 
-       return avc_has_perm(tsec->sid, SECINITSID_SECURITY,
+       return avc_has_perm(sid, SECINITSID_SECURITY,
                            SECCLASS_SECURITY, perms, NULL);
 }