Re: [PATCH] packet: tpacket_snd(): fix signed/unsigned comparison

From: Daniel Borkmann
Date: Tue Jul 28 2015 - 07:07:19 EST


On 07/28/2015 12:57 PM, Alexander Drozdov wrote:
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.

Signed-off-by: Alexander Drozdov <al.drozdov@xxxxxxxxx>

Looks good to me, thanks!

Acked-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/