[PATCH] ipv4: kernel panic when only one unsecured port available

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Cc: <linux-netdev@...>, David Miller <davem@...>, Jeffrey Garzik <jgarzik@...>
Date: Tuesday, October 9, 2007 - 9:59 am

Steps to reproduce:
Server:
  [root@server ~]# cat /etc/exports
  /export *(ro,insecure)
// there is insecure ... I am using ports like "1024 to 61000"
  [root@server ~] service nfs restart=20

Client:
  1.[root@client ~]# echo 32768 32768 > /proc/sys/net/ipv4/ip_local_port_ra=
nge
  32768   32768
// two same numbers, for ex "32769 32769" etc.
  2.[root@client ~]# cat /proc/sys/net/ipv4/ip_local_port_range
  32768   32768
  3.[root@client ~]# mount server:/export /import
=20=20
Actual results:
  Kernel always panics=20

=2D-------------------------------------------------------------------
[PATCH] ipv4: kernel panic when only one unsecured port available

  Patch prevents division by zero. Kernel panics if only one=20
unsecured port available.

Signed-off-by: Anton Arapov <aarapov@redhat.com>
=2D--

 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_soc=
k.c
index fbe7714..00ad079 100644
=2D-- 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 =3D sysctl_local_port_range[0];
 		int high =3D sysctl_local_port_range[1];
 		int remaining =3D (high - low) + 1;
=2D		int rover =3D net_random() % (high - low) + low;
+		int rover =3D net_random() % remaining + low;
=20
 		do {
 			head =3D &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)];

=2D-=20
Anton Arapov, <aarapov@redhat.com>
Kernel Development, Red Hat
GPG Key ID: 0x6FA8C812
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] ipv4: kernel panic when only one unsecured port avai..., Anton Arapov, (Tue Oct 9, 9:59 am)