diff mbox

[2/2] ifb: fix oops when loading the ifb failed

Message ID 51DE9126.5040703@huawei.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Ding Tianhong July 11, 2013, 11:04 a.m. UTC
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>
---
 drivers/net/ifb.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

David Miller July 11, 2013, 7 p.m. UTC | #1
From: Ding Tianhong <dingtianhong@huawei.com>
Date: Thu, 11 Jul 2013 19:04:06 +0800

> 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>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index dc9f6a4..23a33e3 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -291,11 +291,15 @@  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);
 	if (err)
 		__rtnl_link_unregister(&ifb_link_ops);
+
+out:
 	rtnl_unlock();
 
 	return err;