summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4d97213)
raw | patch | inline | side by side (parent: 4d97213)
author | Eric Dumazet <edumazet@google.com> | |
Sat, 30 May 2015 16:16:53 +0000 (09:16 -0700) | ||
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
Tue, 23 Jun 2015 00:01:18 +0000 (17:01 -0700) |
[ Upstream commit beb39db59d14990e401e235faf66a6b9b31240b0 ]
We have two problems in UDP stack related to bogus checksums :
1) We return -EAGAIN 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.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
We have two problems in UDP stack related to bogus checksums :
1) We return -EAGAIN 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.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/udp.c | patch | blob | history | |
net/ipv6/udp.c | patch | blob | history |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index b25e852625d8af9674439b1383870e19326730a3..5db3e2c87e299cfe09d3a81b544d101af652e7b0 100644 (file)
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
}
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;
}
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 20b63d2ab70fdf2adcc463b23c4fe42ae2ab4683..38625a91ec943a1a56d52b07c5bc4f2e345cf18a 100644 (file)
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
}
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;
}