net: net_netdev: Fix error handling in ntb_netdev_init_module()
[ Upstream commitb8f79dccd3] The ntb_netdev_init_module() returns the ntb_transport_register_client() directly without checking its return value, if ntb_transport_register_client() failed, the NTB client device is not unregistered. Fix by unregister NTB client device when ntb_transport_register_client() failed. Fixes:548c237c0a("net: Add support for NTB virtual ethernet device") Signed-off-by: Yuan Can <yuancan@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fe6bc99c27
commit
b080d4668f
1 changed files with 8 additions and 1 deletions
|
|
@ -484,7 +484,14 @@ static int __init ntb_netdev_init_module(void)
|
||||||
rc = ntb_transport_register_client_dev(KBUILD_MODNAME);
|
rc = ntb_transport_register_client_dev(KBUILD_MODNAME);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
return ntb_transport_register_client(&ntb_netdev_client);
|
|
||||||
|
rc = ntb_transport_register_client(&ntb_netdev_client);
|
||||||
|
if (rc) {
|
||||||
|
ntb_transport_unregister_client_dev(KBUILD_MODNAME);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
module_init(ntb_netdev_init_module);
|
module_init(ntb_netdev_init_module);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue