]> git.baikalelectronics.ru Git - kernel.git/commit
net: net_netdev: Fix error handling in ntb_netdev_init_module()
authorYuan Can <yuancan@huawei.com>
Thu, 24 Nov 2022 07:09:17 +0000 (07:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:23:03 +0000 (11:23 +0100)
commit0e2e9a8d6dd33f5e7cdf3fb651a27e1172230ba9
treef7a7e7b89b3250daab77495712c1bd4a5b616e23
parentb89548679ce9db0416d86b2979746ac5bba75cc9
net: net_netdev: Fix error handling in ntb_netdev_init_module()

[ Upstream commit b8f79dccd38edf7db4911c353d9cd792ab13a327 ]

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: f064362e71d9 ("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>
drivers/net/ntb_netdev.c