Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Shawn Bohrer <sbohrer@rgmadvisors.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
979402b1 521130d1

+16
+5
net/ipv4/udp.c
··· 1226 1226 1227 1227 if (unlikely(err)) { 1228 1228 trace_kfree_skb(skb, udp_recvmsg); 1229 + if (!peeked) { 1230 + atomic_inc(&sk->sk_drops); 1231 + UDP_INC_STATS_USER(sock_net(sk), 1232 + UDP_MIB_INERRORS, is_udplite); 1233 + } 1229 1234 goto out_free; 1230 1235 } 1231 1236
+11
net/ipv6/udp.c
··· 394 394 } 395 395 if (unlikely(err)) { 396 396 trace_kfree_skb(skb, udpv6_recvmsg); 397 + if (!peeked) { 398 + atomic_inc(&sk->sk_drops); 399 + if (is_udp4) 400 + UDP_INC_STATS_USER(sock_net(sk), 401 + UDP_MIB_INERRORS, 402 + is_udplite); 403 + else 404 + UDP6_INC_STATS_USER(sock_net(sk), 405 + UDP_MIB_INERRORS, 406 + is_udplite); 407 + } 397 408 goto out_free; 398 409 } 399 410 if (!peeked) {