Skip to content

Commit

Permalink
ifb: fix oops when loading the ifb failed
Browse files Browse the repository at this point in the history
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: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
dingtianhong authored and David S. Miller committed Jul 11, 2013
1 parent 2c8a018 commit f2966cd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ifb.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,17 @@ static int __init ifb_init_module(void)

rtnl_lock();
err = __rtnl_link_register(&ifb_link_ops);
if (err < 0)
goto out;

for (i = 0; i < numifbs && !err; i++) {
err = ifb_init_one(i);
cond_resched();
}
if (err)
__rtnl_link_unregister(&ifb_link_ops);

out:
rtnl_unlock();

return err;
Expand Down

0 comments on commit f2966cd

Please sign in to comment.