diff options
author | Harry Lin <mrregi24@gmail.com> | 2015-07-09 13:00:54 +1000 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-02-22 16:35:29 -0800 |
commit | 5080905535c3c977a96a0ef7faaa5095dafd7760 (patch) | |
tree | 22ad14e07bf644b33640ded8bfbe6bde6b4b1d99 /net/ipv6/udp.c | |
parent | 2acd51f51ffd6e14b24d812da47594f53d917378 (diff) | |
download | kernel_samsung_smdk4412-5080905535c3c977a96a0ef7faaa5095dafd7760.tar.gz kernel_samsung_smdk4412-5080905535c3c977a96a0ef7faaa5095dafd7760.tar.bz2 kernel_samsung_smdk4412-5080905535c3c977a96a0ef7faaa5095dafd7760.zip |
udp: fix behavior of wrong checksums
We have two problems in UDP stack related to bogus checksums :
1 ) We return -EGAIN to application even if receive queue is not empty.
This breaks applications using edge trigger epoll()
2 ) Under UDP flood, we can loop forever without yielding to other
processes, potentially hanging the host, especially on non SMP.
This patch is an attempt to make things better.
We might in the future add extra support for rt applications
wanting to better control time spent doing a recv() in a hostile
environment. For example we could validate checksums before queuing
packets in socket receive queue.
Change-Id: Ic25820228fd735e25a850951e059bf75ae39b653
Signed-off-by: Eruc Dumazet <edumazet@google.com>
Cc: Willem de Brujin <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 5c363cd5c55..823d1ef301f 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -453,10 +453,8 @@ csum_copy_err: } unlock_sock_fast(sk, slow); - if (noblock) - return -EAGAIN; - - /* starting over for a new packet */ + /* starting over for a new packet, but check if we need to yield */ + cond_resched(); msg->msg_flags &= ~MSG_TRUNC; goto try_again; } |