[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#592187: [stable] Bug#576838: virtio network crashes again



On Tue, 2010-08-31 at 17:34 +0200, Lukas Kolbe wrote:
> On Tue, 2010-08-31 at 06:35 -0700, Greg KH wrote:
[...]
> > Then how about convincing the Debian kernel developers to accept these
> > patches, and work through any regressions that might be found and after
> > that, reporting back to us?
> 
> Ben?
> 
> The reason I contacted you was precisely because it went into 2.6.33.2,
> e.g. was already accepted into a -stalbe release. I didn't expect it to
> be such an issue.

That's not likely if people spread FUD about the backlog patches!

Dave, did you explicitly exclude these patches from 2.6.32 when you
submitted them to stable, or is it just that 5534979 "udp: use limited
socket backlog" depends on a1ab77f "ipv6: udp: Optimise multicast
reception"?  The former patch doesn't look too hard to backport to
2.6.32 (see below).

Ben.

From: Zhu Yi <yi.zhu@intel.com>
Date: Thu, 4 Mar 2010 18:01:42 +0000
Subject: [PATCH] udp: use limited socket backlog

[ Upstream commit 55349790d7cbf0d381873a7ece1dcafcffd4aaa9 ]

Make udp adapt to the limited socket backlog change.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: "Pekka Savola (ipv6)" <pekkas@netcore.fi>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[bwh: Backport to 2.6.32]
---
 net/ipv4/udp.c |    6 ++++--
 net/ipv6/udp.c |   20 ++++++++++++++------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index c322f44..0ea57b1 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1174,8 +1174,10 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		rc = __udp_queue_rcv_skb(sk, skb);
-	else
-		sk_add_backlog(sk, skb);
+	else if (sk_add_backlog_limited(sk, skb)) {
+		bh_unlock_sock(sk);
+		goto drop;
+	}
 	bh_unlock_sock(sk);
 
 	return rc;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index cf538ed..154dd6b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -470,16 +470,20 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
 			bh_lock_sock(sk2);
 			if (!sock_owned_by_user(sk2))
 				udpv6_queue_rcv_skb(sk2, buff);
-			else
-				sk_add_backlog(sk2, buff);
+			else if (sk_add_backlog_limited(sk2, buff)) {
+				atomic_inc(&sk2->sk_drops);
+				kfree_skb(buff);
+			}
 			bh_unlock_sock(sk2);
 		}
 	}
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		udpv6_queue_rcv_skb(sk, skb);
-	else
-		sk_add_backlog(sk, skb);
+	else if (sk_add_backlog_limited(sk, skb)) {
+		atomic_inc(&sk->sk_drops);
+		kfree_skb(skb);
+	}
 	bh_unlock_sock(sk);
 out:
 	spin_unlock(&hslot->lock);
@@ -598,8 +602,12 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 	bh_lock_sock(sk);
 	if (!sock_owned_by_user(sk))
 		udpv6_queue_rcv_skb(sk, skb);
-	else
-		sk_add_backlog(sk, skb);
+	else if (sk_add_backlog_limited(sk, skb)) {
+		atomic_inc(&sk->sk_drops);
+		bh_unlock_sock(sk);
+		sock_put(sk);
+		goto discard;
+	}
 	bh_unlock_sock(sk);
 	sock_put(sk);
 	return 0;
-- 
1.7.1

-- 
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: