sctp: label accepted/peeled off sockets
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Wed, 23 Dec 2015 18:44:09 +0000 (16:44 -0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Dec 2015 05:18:47 +0000 (00:18 -0500)
Accepted or peeled off sockets were missing a security label (e.g.
SELinux) which means that socket was in "unlabeled" state.

This patch clones the sock's label from the parent sock and resolves the
issue (similar to AF_BLUETOOTH protocol family).

Cc: Paul Moore <pmoore@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/socket.c

index 570f96ad4527d64382741f928f28ebdaa2cd3afb..529ed357a2cf1543123fa85e0c55fceb76706be3 100644 (file)
@@ -7202,6 +7202,8 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
 
        if (newsk->sk_flags & SK_FLAGS_TIMESTAMP)
                net_enable_timestamp();
+
+       security_sk_clone(sk, newsk);
 }
 
 static inline void sctp_copy_descendant(struct sock *sk_to,