Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1463867 > unrolled thread

[PATCH] net: ipconfig: Fix more use after free

Started byThierry Reding <thierry.reding@gmail.com>
First post2016-08-16 16:50 +0200
Last post2016-08-18 01:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: ipconfig: Fix more use after free Thierry Reding <thierry.reding@gmail.com> - 2016-08-16 16:50 +0200
    Re: [PATCH] net: ipconfig: Fix more use after free David Miller <davem@davemloft.net> - 2016-08-18 01:50 +0200

#1463867 — [PATCH] net: ipconfig: Fix more use after free

FromThierry Reding <thierry.reding@gmail.com>
Date2016-08-16 16:50 +0200
Subject[PATCH] net: ipconfig: Fix more use after free
Message-ID<s6NQK-4jo-31@gated-at.bofh.it>
From: Thierry Reding <treding@nvidia.com>

While commit 9c706a49d660 ("net: ipconfig: fix use after free") avoids
the use after free, the resulting code still ends up calling both the
ic_setup_if() and ic_setup_routes() after calling ic_close_devs(), and
access to the device is still required.

Move the call to ic_close_devs() to the very end of the function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
This applies on top of next-20160816.

 net/ipv4/ipconfig.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 66c2fe602810..ba9cbeafbb2e 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1530,12 +1530,14 @@ static int __init ip_auto_config(void)
 	 * Close all network devices except the device we've
 	 * autoconfigured and set up routes.
 	 */
-	ic_close_devs();
 	if (ic_setup_if() < 0 || ic_setup_routes() < 0)
-		return -1;
+		err = -1;
+	else
+		err = 0;
 
+	ic_close_devs();
 
-	return 0;
+	return err;
 }
 
 late_initcall(ip_auto_config);
-- 
2.9.0

[toc] | [next] | [standalone]


#1464852

FromDavid Miller <davem@davemloft.net>
Date2016-08-18 01:50 +0200
Message-ID<s7iKR-8h7-1@gated-at.bofh.it>
In reply to#1463867
From: Thierry Reding <thierry.reding@gmail.com>
Date: Tue, 16 Aug 2016 16:45:38 +0200

> From: Thierry Reding <treding@nvidia.com>
> 
> While commit 9c706a49d660 ("net: ipconfig: fix use after free") avoids
> the use after free, the resulting code still ends up calling both the
> ic_setup_if() and ic_setup_routes() after calling ic_close_devs(), and
> access to the device is still required.
> 
> Move the call to ic_close_devs() to the very end of the function.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> This applies on top of next-20160816.

Applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web