From: David Miller <davem@davemloft.net>
To: brian.haley@hp.com
Cc: shemminger@linux-foundation.org, den@openvz.org,
aarapov@redhat.com, netdev@vger.kernel.org
Subject: Re: [RFC] more robust inet range checking
Date: Wed, 10 Oct 2007 16:31:08 -0700 (PDT) [thread overview]
Message-ID: <20071010.163108.67884821.davem@davemloft.net> (raw)
In-Reply-To: <470D26E4.2050708@hp.com>
From: Brian Haley <brian.haley@hp.com>
Date: Wed, 10 Oct 2007 15:24:20 -0400
> Stephen Hemminger wrote:
> > --- a/net/ipv4/udp.c 2007-10-10 08:27:00.000000000 -0700
> > +++ b/net/ipv4/udp.c 2007-10-10 09:44:35.000000000 -0700
> > @@ -147,13 +147,13 @@ int __udp_lib_get_port(struct sock *sk,
> > write_lock_bh(&udp_hash_lock);
> >
> > if (!snum) {
> > - int i;
> > - int low = sysctl_local_port_range[0];
> > - int high = sysctl_local_port_range[1];
> > + int i, range[2];
> > unsigned rover, best, best_size_so_far;
>
> Should these be signed ints? They're the only ones that are unsigned,
> but I don't know why.
They have just been hacked inconsistently over the years,
that's the only reason these types are like that.
> > --- a/net/sctp/protocol.c 2007-10-10 08:27:00.000000000 -0700
> > +++ b/net/sctp/protocol.c 2007-10-10 09:58:21.000000000 -0700
> > @@ -1173,7 +1173,6 @@ SCTP_STATIC __init int sctp_init(void)
> > }
> >
> > spin_lock_init(&sctp_port_alloc_lock);
> > - sctp_port_rover = sysctl_local_port_range[0] - 1;
>
> I think you can remove the port_rover definition in sctp/structs.h and
> also the lock that protects it. Patch below for that which can be
> applied on-top of yours.
>
> -Brian
>
>
> Remove SCTP port_rover and port_alloc_lock as they're no longer required.
>
> Signed-off-by: Brian Haley <brian.haley@hp.com>
I like this range checking change, someone please resubmit with
Brian's nits and this SCTP cleanup integrated on top.
I'll probably submit this to stable since it fixes the potential
divide by zero, so test whatever you post :-)
Thanks!
next prev parent reply other threads:[~2007-10-10 23:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-10 14:15 [PATCH] ip_local_port_range low > high check Denis V. Lunev
2007-10-10 17:09 ` [RFC] more robust inet range checking Stephen Hemminger
2007-10-10 17:53 ` Vlad Yasevich
2007-10-10 19:24 ` Brian Haley
2007-10-10 23:31 ` David Miller [this message]
2007-10-10 23:33 ` Stephen Hemminger
2007-10-10 23:34 ` David Miller
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=20071010.163108.67884821.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=aarapov@redhat.com \
--cc=brian.haley@hp.com \
--cc=den@openvz.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.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).