packet: validate msg_namelen in send directly
authorWillem de Bruijn <willemb@google.com>
Mon, 29 Apr 2019 15:53:18 +0000 (11:53 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2019 07:17:17 +0000 (09:17 +0200)
commit6ca4b4080c10536818dcf3590a0dc54162babd24
tree442106e3f911b3092378399797bc584dfb801dcf
parent91c38d754460efab3e91f7bfec1cecbdcfe8384d
packet: validate msg_namelen in send directly

[ Upstream commit 486efdc8f6ce802b27e15921d2353cc740c55451 ]

Packet sockets in datagram mode take a destination address. Verify its
length before passing to dev_hard_header.

Prior to 2.6.14-rc3, the send code ignored sll_halen. This is
established behavior. Directly compare msg_namelen to dev->addr_len.

Change v1->v2: initialize addr in all paths

Fixes: 6b8d95f1795c4 ("packet: validate address length if non-zero")
Suggested-by: David Laight <David.Laight@aculab.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/packet/af_packet.c