]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
selinux: initialize sock security class to default value
authorStephen Smalley <sds@tycho.nsa.gov>
Fri, 10 Jul 2015 21:19:57 +0000 (17:19 -0400)
committerPaul Moore <pmoore@redhat.com>
Mon, 13 Jul 2015 17:31:59 +0000 (13:31 -0400)
Initialize the security class of sock security structures
to the generic socket class.  This is similar to what is
already done in inode_alloc_security for files.  Generally
the sclass field will later by set by socket_post_create
or sk_clone or sock_graft, but for protocol implementations
that fail to call any of these for newly accepted sockets,
we want some sane default that will yield a legitimate
avc denied message with non-garbage values for class and
permission.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
security/selinux/hooks.c

index 4de09f0227b4e502a0c64339a96abcea3ac0709e..ef310f82717d77d42c40170d28ccc439f5b65f20 100644 (file)
@@ -4559,6 +4559,7 @@ static int selinux_sk_alloc_security(struct sock *sk, int family, gfp_t priority
 
        sksec->peer_sid = SECINITSID_UNLABELED;
        sksec->sid = SECINITSID_UNLABELED;
+       sksec->sclass = SECCLASS_SOCKET;
        selinux_netlbl_sk_security_reset(sksec);
        sk->sk_security = sksec;