summaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipconfig.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2016-08-16 16:45:38 +0200
committerDavid S. Miller <davem@davemloft.net>2016-08-17 19:33:40 -0400
commitd2d371ae5dd6af9a6a3d7f50b753627c42868409 (patch)
tree0448b569f7e458ee980c93c7b2c4afcdc5aa7dbc /net/ipv4/ipconfig.c
parent00062a934b7d0c6c5a1a4d774abdba6ebf3af81e (diff)
downloadop-kernel-dev-d2d371ae5dd6af9a6a3d7f50b753627c42868409.zip
op-kernel-dev-d2d371ae5dd6af9a6a3d7f50b753627c42868409.tar.gz
net: ipconfig: Fix more use after free
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipconfig.c')
-rw-r--r--net/ipv4/ipconfig.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 66c2fe6..ba9cbea 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);
OpenPOWER on IntegriCloud