Re: [PATCH V2] net: add accounting for socket backlog
From: Zhu Yi <hidden>
Date: 2010-03-02 02:32:20
From: Zhu Yi <hidden>
Date: 2010-03-02 02:32:20
On Mon, 2010-03-01 at 19:43 +0800, Eric Dumazet wrote:
Thinking again about this, doing this zero initialization at the very end of __release_sock() solves the problem of potential infinite loop in __release_sock(). Since producer will hit the backlog limit. Thanksdiff --git a/net/core/sock.c b/net/core/sock.c index 305cba4..544cf4a 100644 --- a/net/core/sock.c +++ b/net/core/sock.c@@ -1542,6 +1542,11 @@ static void __release_sock(struct sock *sk) bh_lock_sock(sk); } while ((skb = sk->sk_backlog.head) != NULL); + /* + * Doing this zeroing at the end of this function guarantee wecan not + * loop forever while a wild producer attempts to flood us + */ + sk->sk_backlog.len = 0; }
Very good point. I'll add your sob in my next patch. Thanks, -yi