[UDP]: Avoid repeated counting of checksum errors due to peeking

Currently it is possible for two processes to peek on the same socket
and end up incrementing the error counter twice for the same packet.

This patch fixes it by making skb_kill_datagram return whether it
succeeded in unlinking the packet and only incrementing the counter
if it did.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
此提交包含在:
Herbert Xu
2007-12-05 01:51:58 -08:00
提交者 David S. Miller
父節點 c8fecf2242
當前提交 27ab256864
共有 4 個檔案被更改,包括 13 行新增7 行删除

查看文件

@@ -899,9 +899,8 @@ out:
return err;
csum_copy_err:
UDP_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
skb_kill_datagram(sk, skb, flags);
if (!skb_kill_datagram(sk, skb, flags))
UDP_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
if (noblock)
return -EAGAIN;