summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-03 02:44:08 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-03 02:44:08 +0300
commitc742b4bf7a180619831783dcdad6aec062587e54 (patch)
treefea01d86c4da765bb7f8bf016c431e80a6aa14ce
parentfbfd8b5622a18afefb53a69d31fbddecba404f64 (diff)
parentd7f59dc4642ce2fc7b79fcd4ec02ffce7f21eb02 (diff)
downloadlinux-c742b4bf7a180619831783dcdad6aec062587e54.tar.xz
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: selinux: Fix a panic in selinux_netlbl_inode_permission()
-rw-r--r--security/selinux/netlabel.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
index 3f4b26647386..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();