提交 979402b1 编写于 作者: E Eric Dumazet 提交者: David S. Miller

udp: increment UDP_MIB_INERRORS if copy failed

In UDP recvmsg(), we miss an increase of UDP_MIB_INERRORS if the copy
of skb to userspace failed for whatever reason.
Reported-by: NShawn Bohrer <sbohrer@rgmadvisors.com>
Signed-off-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 521130d1
...@@ -1226,6 +1226,11 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -1226,6 +1226,11 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (unlikely(err)) { if (unlikely(err)) {
trace_kfree_skb(skb, udp_recvmsg); trace_kfree_skb(skb, udp_recvmsg);
if (!peeked) {
atomic_inc(&sk->sk_drops);
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS, is_udplite);
}
goto out_free; goto out_free;
} }
......
...@@ -394,6 +394,17 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, ...@@ -394,6 +394,17 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
} }
if (unlikely(err)) { if (unlikely(err)) {
trace_kfree_skb(skb, udpv6_recvmsg); trace_kfree_skb(skb, udpv6_recvmsg);
if (!peeked) {
atomic_inc(&sk->sk_drops);
if (is_udp4)
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS,
is_udplite);
else
UDP6_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS,
is_udplite);
}
goto out_free; goto out_free;
} }
if (!peeked) { if (!peeked) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册