ifb: fix oops when loading the ifb failed
authordingtianhong <dingtianhong@huawei.com>
Thu, 11 Jul 2013 11:04:06 +0000 (19:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Jul 2013 19:00:05 +0000 (12:00 -0700)
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>
drivers/net/ifb.c

index a11f7a45cb5f28c355a535e6a7b543b5628905c1..a3bed28197d29bf9722b6c586f311827d357b501 100644 (file)
@@ -291,6 +291,8 @@ 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);
@@ -298,6 +300,8 @@ static int __init ifb_init_module(void)
        }
        if (err)
                __rtnl_link_unregister(&ifb_link_ops);
+
+out:
        rtnl_unlock();
 
        return err;