]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] MLSXFRM: fix mis-labelling of child sockets
authorDavid Woodhouse <dwmw2@infradead.org>
Fri, 29 Sep 2006 22:50:25 +0000 (15:50 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Sep 2006 22:58:21 +0000 (15:58 -0700)
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 <dwmw2@infradead.org>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
Acked-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
security/selinux/hooks.c

index cac0273ec447930d281074f5cd06985ff118e385..e9969a2fc8462116a5b8cb256e1e8cbc97a7fd3c 100644 (file)
@@ -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);
 }