OSDN Git Service

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)
commit29e8e659f984be00d75ec5fef4e37c88def72712
tree29c8f1c036c34ca5a70aaa81da326d4a6317d0fc
parent1a74e99323746353bba11562a2f2d0aa8102f402
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