Commit 3059be68 authored by Hangbin Liu's avatar Hangbin Liu Committed by Zheng Zengkai
Browse files

net/packet: fix packet_sock xmit return value checking

stable inclusion
from stable-v5.10.113
commit 8fb76adb89f0d576c107e05fd922bf3d04c470d9
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5ISAH

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8fb76adb89f0d576c107e05fd922bf3d04c470d9



--------------------------------

[ Upstream commit 29e8e659 ]

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: 1da177e4 ("Linux-2.6.12-rc2")
Reported-by: default avatarFlavio Leitner <fbl@redhat.com>
Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent 27b6e01f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment