Commit 979402b16cde048ced4839e21cc49e0779352b80
Committed by
David S. Miller
1 parent
521130d11f
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 2 changed files with 16 additions and 0 deletions Side-by-side Diff
net/ipv4/udp.c
... | ... | @@ -1226,6 +1226,11 @@ |
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 |
net/ipv6/udp.c
... | ... | @@ -394,6 +394,17 @@ |
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) { |