]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net/af_iucv: always register net_device notifier
authorJulian Wiedmann <jwi@linux.ibm.com>
Tue, 18 Jun 2019 18:43:01 +0000 (20:43 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 06996c1d4088a0d5f3e7789d7f96b4653cc947cc ]

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: 9fbd87d41392 ("af_iucv: handle netdev events")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/iucv/af_iucv.c

index db9d6e5d354822cf5f93924d51eedb662e581795..c8813a671902e9d713ebd35becb4f7563a765de3 100644 (file)
@@ -2458,6 +2458,13 @@ out:
        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)
 {
        int err;
@@ -2491,11 +2498,18 @@ static int __init afiucv_init(void)
                err = afiucv_iucv_init();
                if (err)
                        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);
        return 0;
 
+out_notifier:
+       if (pr_iucv)
+               afiucv_iucv_exit();
 out_sock:
        sock_unregister(PF_IUCV);
 out_proto:
@@ -2509,12 +2523,11 @@ out:
 static void __exit afiucv_exit(void)
 {
        if (pr_iucv) {
-               device_unregister(af_iucv_dev);
-               driver_unregister(&af_iucv_driver);
-               pr_iucv->iucv_unregister(&af_iucv_handler, 0);
+               afiucv_iucv_exit();
                symbol_put(iucv_if);
-       } else
-               unregister_netdevice_notifier(&afiucv_netdev_notifier);
+       }
+
+       unregister_netdevice_notifier(&afiucv_netdev_notifier);
        dev_remove_pack(&iucv_packet_type);
        sock_unregister(PF_IUCV);
        proto_unregister(&iucv_proto);