selinux: Assign proper class to PF_UNIX/SOCK_RAW sockets
authorLuis Ressel <aranea@aixah.de>
Tue, 25 Jul 2017 19:13:41 +0000 (15:13 -0400)
committerPaul Moore <paul@paul-moore.com>
Tue, 25 Jul 2017 19:13:41 +0000 (15:13 -0400)
For PF_UNIX, SOCK_RAW is synonymous with SOCK_DGRAM (cf.
net/unix/af_unix.c). This is a tad obscure, but libpcap uses it.

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

index 33fd061305c40376c7f632ebcdf6fe5fd7b1e3fc..00ad46e166f6f2f19681a182cd80931c7bb38e7f 100644 (file)
@@ -1303,6 +1303,7 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
                case SOCK_SEQPACKET:
                        return SECCLASS_UNIX_STREAM_SOCKET;
                case SOCK_DGRAM:
+               case SOCK_RAW:
                        return SECCLASS_UNIX_DGRAM_SOCKET;
                }
                break;