aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorDavid Woodhouse <[email protected]>2006-09-29 22:50:25 +0000
committerLinus Torvalds <[email protected]>2006-09-29 22:58:21 +0000
commit2148ccc437a9eac9f0d4b3c27cb1e41f6a48194c (patch)
tree03dc59734526aa654d29e1b81cdad18369598182 /security/selinux/hooks.c
parentMerge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/rolan... (diff)
downloadkernel-2148ccc437a9eac9f0d4b3c27cb1e41f6a48194c.tar.gz
kernel-2148ccc437a9eac9f0d4b3c27cb1e41f6a48194c.zip
[PATCH] MLSXFRM: fix mis-labelling of child sockets
Accepted connections of types other than AF_INET, AF_INET6, AF_UNIX won't have an appropriate label derived from the peer, so don't use it. Signed-off-by: David Woodhouse <[email protected]> Acked-by: Stephen Smalley <[email protected]> Acked-by: James Morris <[email protected]> Acked-by: Paul Moore <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index cac0273ec447..e9969a2fc846 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3619,7 +3619,9 @@ static void selinux_sock_graft(struct sock* sk, struct socket *parent)
struct inode_security_struct *isec = SOCK_INODE(parent)->i_security;
struct sk_security_struct *sksec = sk->sk_security;
- isec->sid = sksec->sid;
+ if (sk->sk_family == PF_INET || sk->sk_family == PF_INET6 ||
+ sk->sk_family == PF_UNIX)
+ isec->sid = sksec->sid;
selinux_netlbl_sock_graft(sk, parent);
}