]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
selinux: handle ICMPv6 consistently with ICMP
authorStephen Smalley <sds@tycho.nsa.gov>
Mon, 9 Jan 2017 15:07:31 +0000 (10:07 -0500)
committerPaul Moore <paul@paul-moore.com>
Mon, 9 Jan 2017 15:07:31 +0000 (10:07 -0500)
commit 79c8b348f215 ("selinux: support distinctions among all network
address families") mapped datagram ICMP sockets to the new icmp_socket
security class, but left ICMPv6 sockets unchanged.  This change fixes
that oversight to handle both kinds of sockets consistently.

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

index 5ce633aabce6e7f2d1d984b7b9ef398ed1c713b7..e4b953f760dd72c1929f2ec09fd10e87ddc02535 100644 (file)
@@ -1295,7 +1295,8 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
                case SOCK_DGRAM:
                        if (default_protocol_dgram(protocol))
                                return SECCLASS_UDP_SOCKET;
-                       else if (extsockclass && protocol == IPPROTO_ICMP)
+                       else if (extsockclass && (protocol == IPPROTO_ICMP ||
+                                                 protocol == IPPROTO_ICMPV6))
                                return SECCLASS_ICMP_SOCKET;
                        else
                                return SECCLASS_RAWIP_SOCKET;