net: ipconfig: Fix more use after free
Subsystems (3)
PATCH 1/1 net: ipconfig: Fix more use after free
From: Thierry Reding <[email protected]>
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.
---
This applies on top of next-20160816.
net/ipv4/ipconfig.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/ipv4/ipconfig.c +5 -3
@@ -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);
Signature · 1 line
2.9.0
From: Thierry Reding <[email protected]>
Date: Tue, 16 Aug 2016 16:45:38 +0200
Quoted 7 lines
From: Thierry Reding <[email protected]>
While commit
9c706a49d660("net: ipconfig: fix use after free") avoids the use after free, the resulting code still ends up calling both theic_setup_if()andic_setup_routes()after callingic_close_devs(), and access to the device is still required.
Quoted 5 lines
Move the call to
ic_close_devs()to the very end of the function.Signed-off-by Thierry Reding <[email protected]>---
This applies on top of next-20160816.
Applied, thanks.