netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udp: increment UDP_MIB_INERRORS if copy failed
@ 2012-09-06  9:34 Eric Dumazet
  2012-09-07 16:59 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2012-09-06  9:34 UTC (permalink / raw)
  To: David Miller; +Cc: Shawn Bohrer, netdev

From: Eric Dumazet <edumazet@google.com>

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>
---
 net/ipv4/udp.c |    5 +++++
 net/ipv6/udp.c |   11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 6f6d1ac..2814f66 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1226,6 +1226,11 @@ try_again:
 
 	if (unlikely(err)) {
 		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;
 	}
 
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 99d0077..07e2bfe 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -394,6 +394,17 @@ try_again:
 	}
 	if (unlikely(err)) {
 		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;
 	}
 	if (!peeked) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] udp: increment UDP_MIB_INERRORS if copy failed
  2012-09-06  9:34 [PATCH] udp: increment UDP_MIB_INERRORS if copy failed Eric Dumazet
@ 2012-09-07 16:59 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-09-07 16:59 UTC (permalink / raw)
  To: eric.dumazet; +Cc: sbohrer, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 06 Sep 2012 11:34:44 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> 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>

Applied to 'net', since this significantly helps diagnose problems.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-07 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06  9:34 [PATCH] udp: increment UDP_MIB_INERRORS if copy failed Eric Dumazet
2012-09-07 16:59 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).