Patchwork Fix infinite retry loop in IP-Config

login
register
mail settings
Submitter Benjamin ZORES
Date Jan. 28, 2009, 9:07 a.m.
Message ID <49802060.5040709@alcatel-lucent.fr>
Download mbox | patch
Permalink /patch/20580/
State Superseded
Delegated to: David Miller
Headers show

Comments

Benjamin ZORES - Jan. 28, 2009, 9:07 a.m.
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
Jarek Poplawski - Jan. 28, 2009, 10:52 a.m.
On 28-01-2009 10:07, Benjamin ZORES wrote:
> 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
> 
> diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
> index 42a0f3d..4911b81 100644
> --- a/net/ipv4/ipconfig.c
> +++ b/net/ipv4/ipconfig.c
> @@ -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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 42a0f3d..4911b81 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -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();