Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 979402b1 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

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: default avatarShawn Bohrer <sbohrer@rgmadvisors.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 521130d1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1226,6 +1226,11 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,

	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;
	}

+11 −0
Original line number Diff line number Diff line
@@ -394,6 +394,17 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
	}
	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) {