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| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Jeff Garzik | Re: fallocate-implementation-on-i86-x86_64-and-powerpc.patch |
git: | |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Arjan van de Ven | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| Natalie Protasevich | [BUG] New Kernel Bugs |
