提交 d2d371ae 编写于 作者: T Thierry Reding 提交者: David S. Miller

net: ipconfig: Fix more use after free

While commit 9c706a49 ("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: NThierry Reding <treding@nvidia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 00062a93
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册