]> git.baikalelectronics.ru Git - kernel.git/commit
packet: bail out of packet_snd() if L2 header creation fails
authorChristoph Jaeger <cj@linux.com>
Sun, 11 Jan 2015 18:01:16 +0000 (13:01 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Jan 2015 02:54:03 +0000 (21:54 -0500)
commit293c7c4334a73d623689c2e7c404779bd2769592
tree94a98b40912ad217baaf9a462f56db788a91e4ed
parent1e234c75b2bc8c0268c0f429a8b0ef34c43c1149
packet: bail out of packet_snd() if L2 header creation fails

Due to a misplaced parenthesis, the expression

  (unlikely(offset) < 0),

which expands to

  (__builtin_expect(!!(offset), 0) < 0),

never evaluates to true. Therefore, when sending packets with
PF_PACKET/SOCK_DGRAM, packet_snd() does not abort as intended
if the creation of the layer 2 header fails.

Spotted by Coverity - CID 1259975 ("Operands don't affect result").

Fixes: 5c7eb7015a4d ("packet: make packet_snd fail on len smaller than l2 header")
Signed-off-by: Christoph Jaeger <cj@linux.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c