ifb: fix oops when loading the ifb failed
authordingtianhong <dingtianhong@huawei.com>
Thu, 11 Jul 2013 11:04:06 +0000 (19:04 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 2 Aug 2013 20:14:50 +0000 (22:14 +0200)
[ Upstream commit f2966cd5691058b8674a20766525bedeaea9cbcf ]

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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/ifb.c

index 4924a1e60c7507f2688af43c9ffbf02cd66a27a0..b19841aca42a5159b994525dfa775b351c54436d 100644 (file)
@@ -290,6 +290,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);
@@ -297,6 +299,8 @@ static int __init ifb_init_module(void)
        }
        if (err)
                __rtnl_link_unregister(&ifb_link_ops);
+
+out:
        rtnl_unlock();
 
        return err;