]> www.infradead.org Git - users/jedix/linux-maple.git/commit
packet: tpacket_snd(): fix signed/unsigned comparison
authorAlexander Drozdov <al.drozdov@gmail.com>
Tue, 28 Jul 2015 10:57:01 +0000 (13:57 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 17:26:24 +0000 (19:26 +0200)
commit2ef3d434d30f074fc744f86a956239feea922b04
tree8e7879e19b4bb0ad1a1b7b0ee8c6c10db78e5dfe
parentd339d03860f21b3f27a674312df09b6ce92c0c42
packet: tpacket_snd(): fix signed/unsigned comparison

[ Upstream commit dbd46ab412b8fb395f2b0ff6f6a7eec9df311550 ]

tpacket_fill_skb() can return a negative value (-errno) which
is stored in tp_len variable. In that case the following
condition will be (but shouldn't be) true:

tp_len > dev->mtu + dev->hard_header_len

as dev->mtu and dev->hard_header_len are both unsigned.

That may lead to just returning an incorrect EMSGSIZE errno
to the user.

Fixes: 52f1454f629fa ("packet: allow to transmit +4 byte in TX_RING slot for VLAN case")
Signed-off-by: Alexander Drozdov <al.drozdov@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/packet/af_packet.c