]> git.baikalelectronics.ru Git - kernel.git/commit
packet: fix match_fanout_group()
authorEric Dumazet <edumazet@google.com>
Fri, 9 Oct 2015 18:29:32 +0000 (11:29 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Oct 2015 02:42:38 +0000 (19:42 -0700)
commita7349c9a8868e7b7386db604dd1cabc950b6fd0c
tree41342a8fa391439d545b19145c23b33af9416a6d
parentb72a8a06dc3dac313887e7915a69fcac2e09ff5b
packet: fix match_fanout_group()

Recent TCP listener patches exposed a prior af_packet bug :
match_fanout_group() blindly assumes it is always safe
to cast sk to a packet socket to compare fanout with af_packet_priv

But SYNACK packets can be sent while attached to request_sock, which
are smaller than a "struct sock".

We can read non existent memory and crash.

Fixes: a729d3e6951d ("af_packet: don't emit packet on orig fanout group")
Fixes: 4b6a53b8f218 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Eric Leblond <eric@regit.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c