Re: [PATCH net] packet: bail out of packet_snd() if L2 header creation fails

From: Willem de Bruijn
Date: Sun Jan 11 2015 - 13:49:41 EST


On Sun, Jan 11, 2015 at 1:35 PM, Eric Dumazet <eric.dumazet@xxxxxxxxx> wrote:
> On Sun, 2015-01-11 at 13:01 -0500, Christoph Jaeger wrote:
>> 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: 9c7077622dd9 ("packet: make packet_snd fail on len smaller than l2 header")
>> Signed-off-by: Christoph Jaeger <cj@xxxxxxxxx>
>> ---
>
> Nice catch !
>
> Acked-by: Eric Dumazet <edumazet@xxxxxxxxxx>
>

Indeed. I'm responsible for that typo. Thanks a lot for catching it!

Acked-by: Willem de Bruijn <willemb@xxxxxxxxxx>
--
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/