]> git.baikalelectronics.ru Git - kernel.git/commit
net/packet: fix packet_sock xmit return value checking
authorHangbin Liu <liuhangbin@gmail.com>
Thu, 14 Apr 2022 08:49:25 +0000 (16:49 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Apr 2022 10:17:30 +0000 (11:17 +0100)
commitebe39b35bc53ef75cb627b94ef30e2be5b3c4d0b
tree29c8f1c036c34ca5a70aaa81da326d4a6317d0fc
parent536a1a45c908e3b64a1259bc4b25a8422e2e9ed0
net/packet: fix packet_sock xmit return value checking

packet_sock xmit could be dev_queue_xmit, which also returns negative
errors. So only checking positive errors is not enough, or userspace
sendmsg may return success while packet is not send out.

Move the net_xmit_errno() assignment in the braces as checkpatch.pl said
do not use assignment in if condition.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c