diff options
author | James Morris <jmorris@namei.org> | 2009-03-24 00:52:46 +0100 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-03-24 00:52:46 +0100 |
commit | 703a3cd72817e99201cef84a8a7aecc60b2b3581 (patch) | |
tree | 3e943755178ff410694722bb031f523136fbc432 /security/selinux | |
parent | SELinux: inode_doinit_with_dentry drop no dentry printk (diff) | |
parent | Linux 2.6.29 (diff) | |
download | linux-703a3cd72817e99201cef84a8a7aecc60b2b3581.tar.xz linux-703a3cd72817e99201cef84a8a7aecc60b2b3581.zip |
Merge branch 'master' into next
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/netlabel.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c index f58701a7b728..350794ab9b42 100644 --- a/security/selinux/netlabel.c +++ b/security/selinux/netlabel.c @@ -386,11 +386,12 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask) if (!S_ISSOCK(inode->i_mode) || ((mask & (MAY_WRITE | MAY_APPEND)) == 0)) return 0; - sock = SOCKET_I(inode); sk = sock->sk; + if (sk == NULL) + return 0; sksec = sk->sk_security; - if (sksec->nlbl_state != NLBL_REQUIRE) + if (sksec == NULL || sksec->nlbl_state != NLBL_REQUIRE) return 0; local_bh_disable(); @@ -490,8 +491,10 @@ int selinux_netlbl_socket_setsockopt(struct socket *sock, lock_sock(sk); rc = netlbl_sock_getattr(sk, &secattr); release_sock(sk); - if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) + if (rc == 0) rc = -EACCES; + else if (rc == -ENOMSG) + rc = 0; netlbl_secattr_destroy(&secattr); } |