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 Client: 1.[root@client ~]# echo 32768 32768 > /proc/sys/net/ipv4/ip_local_port_range 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 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 <[email protected]> --- 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)]; -- Anton Arapov, <[email protected]> Kernel Development, Red Hat GPG Key ID: 0x6FA8C812
Attachment:
pgpDOdLAZIeDa.pgp
Description: PGP signature
- Follow-Ups:
- Re: [PATCH] ipv4: kernel panic when only one unsecured port available
- From: Andrew Morton <[email protected]>
- Re: [PATCH] ipv4: kernel panic when only one unsecured port available
- Prev by Date: Re: [PATCH] Version 3 (2.6.23-rc8) Smack: Simplified Mandatory Access Control Kernel
- Next by Date: Re: [PATCH -mm -v4 1/3] i386/x86_64 boot: setup data
- Previous by thread: howto boost write(2) performance?
- Next by thread: Re: [PATCH] ipv4: kernel panic when only one unsecured port available
- Index(es):