Skip to contentSkip to conversation

Fix infinite retry loop in IP-Config

PATCH In review Benjamin ZORES 3 participants 7 messages Jan 28, 2009 – Jan 30, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix infinite retry loop in IP-Config

Hi,

The attached patch fixes some bug with ip-config max retry number. In ip_auto_config(), kernel tries to retrieve IP configuration forever in case of NFS root and some specific amount of time otherwise.

The problem is that, in case of error, the code jump to the try_try_again goto statement, that reassigns the retry number counter, which obviously leads to an infinite loop if IP config fails.

The attached patch corrects this behavior.
Hope one can push it to mainstream kernel tree.

Ben

net/ipv4/ipconfig.c +1 -2
index 42a0f3d..4911b81 100644
@@ -1268,6 +1268,7 @@ __be32 __init root_nfs_parse_addr(char *name)
 static int __init ip_auto_config(void)
 {
 	__be32 addr;
+	 int retries = CONF_OPEN_RETRIES;
 
 #ifdef CONFIG_PROC_FS
 	proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
@@ -1305,8 +1306,6 @@ static int __init ip_auto_config(void)
 	    ic_first_dev->next) {
 #ifdef IPCONFIG_DYNAMIC
 
-		int retries = CONF_OPEN_RETRIES;
-
 		if (ic_dynamic() < 0) {
 			ic_close_devs();
 
#1 lore raw
Quoted 20 lines · Benjamin ZORES

Hi,

The attached patch fixes some bug with ip-config max retry number. In ip_auto_config(), kernel tries to retrieve IP configuration forever in case of NFS root and some specific amount of time otherwise.

The problem is that, in case of error, the code jump to the try_try_again goto statement, that reassigns the retry number counter, which obviously leads to an infinite loop if IP config fails.

The attached patch corrects this behavior.
Hope one can push it to mainstream kernel tree.

Ben

net/ipv4/ipconfig.c +0 -0
index 42a0f3d..4911b81 100644

net/ipv4/ipconfig.c __be32 __init root_nfs_parse_addr(char *name) · line 1271

Quoted 4 lines
net/ipv4/ipconfig.c +1 -0
@@ -1268,6 +1268,7 @@ __be32 __init root_nfs_parse_addr(char *name)
 static int __init ip_auto_config(void)
 {
 	__be32 addr;
+	 int retries = CONF_OPEN_RETRIES;

Doesn't it need "#ifdef IPCONFIG_DYNAMIC" to prevent a compiler warning? I guess you could add a "Signed-off-by:" line BTW.

Jarek P.

#2 lore raw
Quoted 17 lines · Jarek Poplawski
Quoted 15 lines · Benjamin ZORES

Hi,

The attached patch fixes some bug with ip-config max retry number. In ip_auto_config(), kernel tries to retrieve IP configuration forever in case of NFS root and some specific amount of time otherwise.

The problem is that, in case of error, the code jump to the try_try_again goto statement, that reassigns the retry number counter, which obviously leads to an infinite loop if IP config fails.

The attached patch corrects this behavior.
Hope one can push it to mainstream kernel tree.

Ben

Quoted 14 lines

net/ipv4/ipconfig.c __be32 __init root_nfs_parse_addr(char *name) · line 1272

Quoted 10 lines
net/ipv4/ipconfig.c +1 -0
index 42a0f3d..4911b81 100644
@@ -1268,6 +1268,7 @@ __be32 __init root_nfs_parse_addr(char *name)
 static int __init ip_auto_config(void)
 {
 	__be32 addr;
+	 int retries = CONF_OPEN_RETRIES;
 

Doesn't it need "#ifdef IPCONFIG_DYNAMIC" to prevent a compiler warning? I guess you could add a "Signed-off-by:" line BTW.

You're perfectly right about this.
Attached an updated version of the patch.

Ben

commit 4f9928e4ed6aae2a4c2f2216cab1c16e38631a88
Author: Benjamin Zores <[email protected]>

Date: Wed Jan 28 13:03:07 2009 +0100

fix infinite retry loop in IP-Config

net/ipv4/ipconfig.c +3 -2
index 42a0f3d..5fad34d 100644
@@ -1268,6 +1268,9 @@ __be32 __init root_nfs_parse_addr(char *name)
 static int __init ip_auto_config(void)
 {
        __be32 addr;
+#ifdef IPCONFIG_DYNAMIC
+        int retries = CONF_OPEN_RETRIES;
+#endif
 
 #ifdef CONFIG_PROC_FS
        proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
@@ -1305,8 +1308,6 @@ static int __init ip_auto_config(void)
            ic_first_dev->next) {
 #ifdef IPCONFIG_DYNAMIC
 
-               int retries = CONF_OPEN_RETRIES;
-
                if (ic_dynamic() < 0) {
                        ic_close_devs();
 
#3 lore raw
Quoted 32 lines · Benjamin ZORES
Quoted 17 lines · Jarek Poplawski
Quoted 15 lines · Benjamin ZORES

Hi,

The attached patch fixes some bug with ip-config max retry number. In ip_auto_config(), kernel tries to retrieve IP configuration forever in case of NFS root and some specific amount of time otherwise.

The problem is that, in case of error, the code jump to the try_try_again goto statement, that reassigns the retry number counter, which obviously leads to an infinite loop if IP config fails.

The attached patch corrects this behavior.
Hope one can push it to mainstream kernel tree.

Ben

Quoted 14 lines

net/ipv4/ipconfig.c __be32 __init root_nfs_parse_addr(char *name) · line 1272

Quoted 10 lines
net/ipv4/ipconfig.c +1 -0
index 42a0f3d..4911b81 100644
@@ -1268,6 +1268,7 @@ __be32 __init root_nfs_parse_addr(char *name)
 static int __init ip_auto_config(void)
 {
     __be32 addr;
+     int retries = CONF_OPEN_RETRIES;
 

Doesn't it need "#ifdef IPCONFIG_DYNAMIC" to prevent a compiler warning? I guess you could add a "Signed-off-by:" line BTW.

Quoted 2 lines

You're perfectly right about this.
Attached an updated version of the patch.

Any chance of having it merged ?

Ben

maintainer
#4 lore raw

From: Benjamin ZORES <[email protected]>
Date: Thu, 29 Jan 2009 16:33:35 +0100

Quoted 1 line

Any chance of having it merged ?

Please be patient, I haven't even had a chance to
read over your patch yet.

maintainer
#5 lore raw
In reply to Benjamin ZORES

From: Benjamin ZORES <[email protected]>
Date: Wed, 28 Jan 2009 13:08:15 +0100

Quoted 16 lines
Quoted 15 lines · Jarek Poplawski

net/ipv4/ipconfig.c __be32 __init root_nfs_parse_addr(char *name) · line 1272

Quoted 10 lines · Benjamin ZORES
net/ipv4/ipconfig.c +1 -0
index 42a0f3d..4911b81 100644
@@ -1268,6 +1268,7 @@ __be32 __init root_nfs_parse_addr(char *name)
 static int __init ip_auto_config(void)
 {
 	__be32 addr;
+	 int retries = CONF_OPEN_RETRIES;
 

Doesn't it need "#ifdef IPCONFIG_DYNAMIC" to prevent a compiler
warning? I guess you could add a "Signed-off-by:" line BTW.

Quoted 2 lines

You're perfectly right about this.
Attached an updated version of the patch.

Patch applied, thank you.

#6 lore raw
Quoted 24 lines · David Miller

From: Benjamin ZORES <[email protected]>
Date: Wed, 28 Jan 2009 13:08:15 +0100

Quoted 20 lines
Quoted 18 lines · Jarek Poplawski

net/ipv4/ipconfig.c __be32 __init root_nfs_parse_addr(char *name) · line 1273

Quoted 11 lines · Benjamin ZORES
net/ipv4/ipconfig.c +1 -0
index 42a0f3d..4911b81 100644
@@ -1268,6 +1268,7 @@ __be32 __init root_nfs_parse_addr(char *name)
 static int __init ip_auto_config(void)
 {
 	__be32 addr;
+	 int retries = CONF_OPEN_RETRIES;
 
 

Doesn't it need "#ifdef IPCONFIG_DYNAMIC" to prevent a compiler
warning? I guess you could add a "Signed-off-by:" line BTW.

Quoted 5 lines
Quoted 3 lines

You're perfectly right about this.
Attached an updated version of the patch.

Patch applied, thank you.

Be my guest. Thanks to you.

Ben