From: Willem de Bruijn Date: Fri, 24 Jun 2016 20:02:35 +0000 (-0400) Subject: sock_diag: do not broadcast raw socket destruction X-Git-Tag: firefly_0821_release~176^2~4^2~39^2~25 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=348a1cd82cfc4c4b4f7b6775aae398c337cc03b8;p=firefly-linux-kernel-4.4.55.git sock_diag: do not broadcast raw socket destruction [ Upstream commit 9a0fee2b552b1235fb1706ae1fc664ae74573be8 ] Diag intends to broadcast tcp_sk and udp_sk socket destruction. Testing sk->sk_protocol for IPPROTO_TCP/IPPROTO_UDP alone is not sufficient for this. Raw sockets can have the same type. Add a test for sk->sk_type. Fixes: eb4cb008529c ("sock_diag: define destruction multicast groups") Signed-off-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h index fddebc617469..8ff34ed1ae8a 100644 --- a/include/linux/sock_diag.h +++ b/include/linux/sock_diag.h @@ -35,6 +35,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk) { switch (sk->sk_family) { case AF_INET: + if (sk->sk_type == SOCK_RAW) + return SKNLGRP_NONE; + switch (sk->sk_protocol) { case IPPROTO_TCP: return SKNLGRP_INET_TCP_DESTROY; @@ -44,6 +47,9 @@ enum sknetlink_groups sock_diag_destroy_group(const struct sock *sk) return SKNLGRP_NONE; } case AF_INET6: + if (sk->sk_type == SOCK_RAW) + return SKNLGRP_NONE; + switch (sk->sk_protocol) { case IPPROTO_TCP: return SKNLGRP_INET6_TCP_DESTROY;