Commit c196084c authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Kleber Sacilotto de Souza

net/af_iucv: always register net_device notifier

BugLink: https://bugs.launchpad.net/bugs/1864773

[ Upstream commit 06996c1d ]

Even when running as VM guest (ie pr_iucv != NULL), af_iucv can still
open HiperTransport-based connections. For robust operation these
connections require the af_iucv_netdev_notifier, so register it
unconditionally.

Also handle any error that register_netdevice_notifier() returns.

Fixes: 9fbd87d4 ("af_iucv: handle netdev events")
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 4b99582d
...@@ -2404,6 +2404,13 @@ static int afiucv_iucv_init(void) ...@@ -2404,6 +2404,13 @@ static int afiucv_iucv_init(void)
return err; return err;
} }
static void afiucv_iucv_exit(void)
{
device_unregister(af_iucv_dev);
driver_unregister(&af_iucv_driver);
pr_iucv->iucv_unregister(&af_iucv_handler, 0);
}
static int __init afiucv_init(void) static int __init afiucv_init(void)
{ {
int err; int err;
...@@ -2437,11 +2444,18 @@ static int __init afiucv_init(void) ...@@ -2437,11 +2444,18 @@ static int __init afiucv_init(void)
err = afiucv_iucv_init(); err = afiucv_iucv_init();
if (err) if (err)
goto out_sock; goto out_sock;
} else }
register_netdevice_notifier(&afiucv_netdev_notifier);
err = register_netdevice_notifier(&afiucv_netdev_notifier);
if (err)
goto out_notifier;
dev_add_pack(&iucv_packet_type); dev_add_pack(&iucv_packet_type);
return 0; return 0;
out_notifier:
if (pr_iucv)
afiucv_iucv_exit();
out_sock: out_sock:
sock_unregister(PF_IUCV); sock_unregister(PF_IUCV);
out_proto: out_proto:
...@@ -2455,12 +2469,11 @@ static int __init afiucv_init(void) ...@@ -2455,12 +2469,11 @@ static int __init afiucv_init(void)
static void __exit afiucv_exit(void) static void __exit afiucv_exit(void)
{ {
if (pr_iucv) { if (pr_iucv) {
device_unregister(af_iucv_dev); afiucv_iucv_exit();
driver_unregister(&af_iucv_driver);
pr_iucv->iucv_unregister(&af_iucv_handler, 0);
symbol_put(iucv_if); symbol_put(iucv_if);
} else }
unregister_netdevice_notifier(&afiucv_netdev_notifier);
unregister_netdevice_notifier(&afiucv_netdev_notifier);
dev_remove_pack(&iucv_packet_type); dev_remove_pack(&iucv_packet_type);
sock_unregister(PF_IUCV); sock_unregister(PF_IUCV);
proto_unregister(&iucv_proto); proto_unregister(&iucv_proto);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment