Message ID | 51DE9122.9090908@huawei.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Ding Tianhong <dingtianhong@huawei.com> Date: Thu, 11 Jul 2013 19:04:02 +0800 > We rename the dummy in modprobe.conf like this: > > install dummy0 /sbin/modprobe -o dummy0 --ignore-install dummy > install dummy1 /sbin/modprobe -o dummy1 --ignore-install dummy > > We got oops when we run the command: > > modprobe dummy0 > modprobe dummy1 ... > The reason is that when loading dummy, if __rtnl_link_register() return failed, > the init_module should return and avoid take the wrong path. > > Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com> > 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 --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 42aa54a..b710c6b 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -185,6 +185,8 @@ static int __init dummy_init_module(void) rtnl_lock(); err = __rtnl_link_register(&dummy_link_ops); + if (err < 0) + goto out; for (i = 0; i < numdummies && !err; i++) { err = dummy_init_one(); @@ -192,6 +194,8 @@ static int __init dummy_init_module(void) } if (err < 0) __rtnl_link_unregister(&dummy_link_ops); + +out: rtnl_unlock(); return err;