[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 10 Oct 2007 10:54:52 +0400
From: "Denis V. Lunev" <den@...ru>
To: Anton Arapov <aarapov@...hat.com>
CC: netdev@...r.kernel.org
Subject: Re: [PATCH] ipv4: kernel panic when only one unsecured port available
This code is broken from the very beginning.
iris den # cat /proc/sys/net/ipv4/ip_local_port_range
32768 61000
iris den # echo 32768 32 >/proc/sys/net/ipv4/ip_local_port_range
iris den # cat /proc/sys/net/ipv4/ip_local_port_range
32768 32
iris den # echo 32768 61000 >/proc/sys/net/ipv4/ip_local_port_range
Regards,
Den
Anton Arapov wrote:
> Steps to reproduce:
> Server:
> [root@...ver ~]# cat /etc/exports
> /export *(ro,insecure)
> // there is insecure ... I am using ports like "1024 to 61000"
> [root@...ver ~] service nfs restart
>
> Client:
> 1.[root@...ent ~]# echo 32768 32768 > /proc/sys/net/ipv4/ip_local_port_range
> 32768 32768
> // two same numbers, for ex "32769 32769" etc.
> 2.[root@...ent ~]# cat /proc/sys/net/ipv4/ip_local_port_range
> 32768 32768
> 3.[root@...ent ~]# mount server:/export /import
>
> Actual results:
> Kernel always panics
>
> --------------------------------------------------------------------
> [PATCH] ipv4: kernel panic when only one unsecured port available
>
> Patch prevents division by zero. Kernel panics if only one
> unsecured port available.
>
> Signed-off-by: Anton Arapov <aarapov@...hat.com>
> ---
>
> net/ipv4/inet_connection_sock.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
> index fbe7714..00ad079 100644
> --- a/net/ipv4/inet_connection_sock.c
> +++ b/net/ipv4/inet_connection_sock.c
> @@ -80,7 +80,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
> int low = sysctl_local_port_range[0];
> int high = sysctl_local_port_range[1];
> int remaining = (high - low) + 1;
> - int rover = net_random() % (high - low) + low;
> + int rover = net_random() % remaining + low;
>
> do {
> head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)];
>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists