diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-11-08 10:20:19 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-08 20:53:10 -0800 |
commit | f6b8f32ca71406de718391369490f6b1e81fe0bb (patch) | |
tree | 6a9d65cc246c74a78d7274d1911baf38ffc8eaf0 /net/ipv4/udp.c | |
parent | a1ab77f97ed03f5dae66ae4c64375beffab83772 (diff) | |
download | lwn-f6b8f32ca71406de718391369490f6b1e81fe0bb.tar.gz lwn-f6b8f32ca71406de718391369490f6b1e81fe0bb.zip |
udp: multicast RX should increment SNMP/sk_drops counter in allocation failures
When skb_clone() fails, we should increment sk_drops and SNMP counters.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 9d9072c6cce7..d73e9170536b 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1335,12 +1335,22 @@ static void flush_stack(struct sock **stack, unsigned int count, { unsigned int i; struct sk_buff *skb1 = NULL; + struct sock *sk; for (i = 0; i < count; i++) { + sk = stack[i]; if (likely(skb1 == NULL)) skb1 = (i == final) ? skb : skb_clone(skb, GFP_ATOMIC); - if (skb1 && udp_queue_rcv_skb(stack[i], skb1) <= 0) + if (!skb1) { + atomic_inc(&sk->sk_drops); + UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, + IS_UDPLITE(sk)); + UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, + IS_UDPLITE(sk)); + } + + if (skb1 && udp_queue_rcv_skb(sk, skb1) <= 0) skb1 = NULL; } if (unlikely(skb1)) |