netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH V2] net: add accounting for socket backlog
Date: Tue, 02 Mar 2010 10:34:02 +0800	[thread overview]
Message-ID: <1267497242.23196.62.camel@debian> (raw)
In-Reply-To: <1267443828.3039.7.camel@edumazet-laptop>

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.
> 
> Thanks
> 
> diff --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 we
> can 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


      reply	other threads:[~2010-03-02  2:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-26  9:27 [PATCH V2] net: add accounting for socket backlog Zhu Yi
2010-02-26 12:05 ` David Miller
2010-03-01  2:08   ` Zhu Yi
2010-03-01  2:10     ` David Miller
2010-02-28  5:31 ` Eric Dumazet
2010-03-01 11:43   ` Eric Dumazet
2010-03-02  2:34     ` Zhu Yi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1267497242.23196.62.camel@debian \
    --to=yi.zhu@intel.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).