* [PATCH] net: ipconfig: Fix more use after free
@ 2016-08-16 14:45 Thierry Reding
2016-08-17 23:34 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2016-08-16 14:45 UTC (permalink / raw)
To: David S . Miller
Cc: Uwe Kleine-König, Geert Uytterhoeven, netdev, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: ipconfig: Fix more use after free
2016-08-16 14:45 [PATCH] net: ipconfig: Fix more use after free Thierry Reding
@ 2016-08-17 23:34 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-08-17 23:34 UTC (permalink / raw)
To: thierry.reding; +Cc: u.kleine-koenig, geert+renesas, netdev, linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-17 23:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-16 14:45 [PATCH] net: ipconfig: Fix more use after free Thierry Reding
2016-08-17 23:34 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).