]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Jul 2015 07:09:58 +0000 (00:09 -0700)
commit69acfd5414b188ba076c89b1f57c026a89e08ef3
tree119701e15a3be300e89a3cfd2860e51f16ea86ad
parentbe0ff4b1e47b84bbdf79a30271217c712bf7bb74
packet: tpacket_snd(): fix signed/unsigned comparison

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: c320ae4bef7e2 ("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>
net/packet/af_packet.c