netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: weid@np.css.fujitsu.com
Cc: netdev@vger.kernel.org
Subject: Re: Fix bugs in "Whether sock accept queue is full" checking
Date: Fri, 02 Mar 2007 12:51:58 -0800 (PST)	[thread overview]
Message-ID: <20070302.125158.88476099.davem@davemloft.net> (raw)
In-Reply-To: <1171470657.7414.15.camel@LINE>

From: weidong <weid@np.css.fujitsu.com>
Date: Wed, 14 Feb 2007 11:30:57 -0500

> diff -ruN old/include/net/sock.h new/include/net/sock.h
> --- old/include/net/sock.h	2007-02-03 08:38:21.000000000 -0500
> +++ new/include/net/sock.h	2007-02-03 08:38:30.000000000 -0500
> @@ -426,7 +426,7 @@
>  
>  static inline int sk_acceptq_is_full(struct sock *sk)
>  {
> -	return sk->sk_ack_backlog > sk->sk_max_ack_backlog;
> +	return sk->sk_ack_backlog >= sk->sk_max_ack_backlog;
>  }
>  
>  /*

I've applied this patch, and also fixed a similar case
I spotted in AF_UNIX after doing a quick audit.

Thank you.

commit 626d548a8d145a032cff9237245f8ac9d9056ac1
Author: David S. Miller <davem@sunset.davemloft.net>
Date:   Fri Mar 2 12:49:23 2007 -0800

    [AF_UNIX]: Test against sk_max_ack_backlog properly.
    
    This brings things inline with the sk_acceptq_is_full() bug
    fix.  The limit test should be x >= sk_max_ack_backlog.
    
    Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 6069716..51ca438 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -934,7 +934,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo)
 
 	sched = !sock_flag(other, SOCK_DEAD) &&
 		!(other->sk_shutdown & RCV_SHUTDOWN) &&
-		(skb_queue_len(&other->sk_receive_queue) >
+		(skb_queue_len(&other->sk_receive_queue) >=
 		 other->sk_max_ack_backlog);
 
 	unix_state_runlock(other);
@@ -1008,7 +1008,7 @@ restart:
 	if (other->sk_state != TCP_LISTEN)
 		goto out_unlock;
 
-	if (skb_queue_len(&other->sk_receive_queue) >
+	if (skb_queue_len(&other->sk_receive_queue) >=
 	    other->sk_max_ack_backlog) {
 		err = -EAGAIN;
 		if (!timeo)
@@ -1381,7 +1381,7 @@ restart:
 	}
 
 	if (unix_peer(other) != sk &&
-	    (skb_queue_len(&other->sk_receive_queue) >
+	    (skb_queue_len(&other->sk_receive_queue) >=
 	     other->sk_max_ack_backlog)) {
 		if (!timeo) {
 			err = -EAGAIN;

      parent reply	other threads:[~2007-03-02 20:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-14 16:30 Fix bugs in "Whether sock accept queue is full" checking weidong
2007-02-22 11:13 ` David Miller
2007-02-22 18:09   ` Vlad Yasevich
2007-03-02 20:51 ` David Miller [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=20070302.125158.88476099.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=weid@np.css.fujitsu.com \
    /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).