public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Changli Gao <xiaosuo@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] net: Check the argument for listen(2)
Date: Fri, 28 Jun 2013 18:32:34 +0200	[thread overview]
Message-ID: <20130628163234.GA651@order.stressinduktion.org> (raw)
In-Reply-To: <1372436942.3301.286.camel@edumazet-glaptop>

On Fri, Jun 28, 2013 at 09:29:02AM -0700, Eric Dumazet wrote:
> On Sat, 2013-06-29 at 00:14 +0800, Changli Gao wrote:
> > --- a/net/ipv4/af_inet.c
> > +++ b/net/ipv4/af_inet.c
> > @@ -198,6 +198,9 @@ int inet_listen(struct socket *sock, int backlog)
> >  	unsigned char old_state;
> >  	int err;
> >  
> > +	if (backlog >= (1 << 16))
> > +		return EINVAL;
> > +
> >  	lock_sock(sk);
> >  
> >  	err = -EINVAL;
> 
> This seems pretty buggy to me.
> 
> 1) EINVAL is not -EINVAL
> 
> 2) This might break existing applications.

Yes, we should clamp the value to netdev_max_backlog.

Greetings,

  Hannes

  reply	other threads:[~2013-06-28 16:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 16:14 [PATCH] net: Check the argument for listen(2) Changli Gao
2013-06-28 16:29 ` Eric Dumazet
2013-06-28 16:32   ` Hannes Frederic Sowa [this message]
2013-06-28 16:34     ` Hannes Frederic Sowa
2013-06-28 16:48       ` Eric Dumazet
2013-06-28 16:30 ` Stephen Hemminger

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=20130628163234.GA651@order.stressinduktion.org \
    --to=hannes@stressinduktion.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiaosuo@gmail.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