Commit f2966cd5 authored by dingtianhong's avatar dingtianhong Committed by David S. Miller

ifb: fix oops when loading the ifb failed

If __rtnl_link_register() return faild when loading the ifb, it will
take the wrong path and get oops, so fix it just like dummy.
Signed-off-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2c8a0189
...@@ -291,6 +291,8 @@ static int __init ifb_init_module(void) ...@@ -291,6 +291,8 @@ static int __init ifb_init_module(void)
rtnl_lock(); rtnl_lock();
err = __rtnl_link_register(&ifb_link_ops); err = __rtnl_link_register(&ifb_link_ops);
if (err < 0)
goto out;
for (i = 0; i < numifbs && !err; i++) { for (i = 0; i < numifbs && !err; i++) {
err = ifb_init_one(i); err = ifb_init_one(i);
...@@ -298,6 +300,8 @@ static int __init ifb_init_module(void) ...@@ -298,6 +300,8 @@ static int __init ifb_init_module(void)
} }
if (err) if (err)
__rtnl_link_unregister(&ifb_link_ops); __rtnl_link_unregister(&ifb_link_ops);
out:
rtnl_unlock(); rtnl_unlock();
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment