diff options
| author | Julian Wiedmann <jwi@linux.ibm.com> | 2019-06-18 14:43:01 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-06-19 16:26:33 -0400 |
| commit | 06996c1d4088a0d5f3e7789d7f96b4653cc947cc (patch) | |
| tree | 4a8e26a016df3c714c781189045c89a0d2e7516e | |
| parent | 238965b71b968dc5b3c0fe430e946f488322c4b5 (diff) | |
net/af_iucv: always register net_device notifier
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>
| -rw-r--r-- | net/iucv/af_iucv.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index 5264a182d2c3..09e1694b6d34 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
| @@ -2440,6 +2440,13 @@ out: | |||
| 2440 | return err; | 2440 | return err; |
| 2441 | } | 2441 | } |
| 2442 | 2442 | ||
| 2443 | static void afiucv_iucv_exit(void) | ||
| 2444 | { | ||
| 2445 | device_unregister(af_iucv_dev); | ||
| 2446 | driver_unregister(&af_iucv_driver); | ||
| 2447 | pr_iucv->iucv_unregister(&af_iucv_handler, 0); | ||
| 2448 | } | ||
| 2449 | |||
| 2443 | static int __init afiucv_init(void) | 2450 | static int __init afiucv_init(void) |
| 2444 | { | 2451 | { |
| 2445 | int err; | 2452 | int err; |
| @@ -2473,11 +2480,18 @@ static int __init afiucv_init(void) | |||
| 2473 | err = afiucv_iucv_init(); | 2480 | err = afiucv_iucv_init(); |
| 2474 | if (err) | 2481 | if (err) |
| 2475 | goto out_sock; | 2482 | goto out_sock; |
| 2476 | } else | 2483 | } |
| 2477 | register_netdevice_notifier(&afiucv_netdev_notifier); | 2484 | |
| 2485 | err = register_netdevice_notifier(&afiucv_netdev_notifier); | ||
| 2486 | if (err) | ||
| 2487 | goto out_notifier; | ||
| 2488 | |||
| 2478 | dev_add_pack(&iucv_packet_type); | 2489 | dev_add_pack(&iucv_packet_type); |
| 2479 | return 0; | 2490 | return 0; |
| 2480 | 2491 | ||
| 2492 | out_notifier: | ||
| 2493 | if (pr_iucv) | ||
| 2494 | afiucv_iucv_exit(); | ||
| 2481 | out_sock: | 2495 | out_sock: |
| 2482 | sock_unregister(PF_IUCV); | 2496 | sock_unregister(PF_IUCV); |
| 2483 | out_proto: | 2497 | out_proto: |
| @@ -2491,12 +2505,11 @@ out: | |||
| 2491 | static void __exit afiucv_exit(void) | 2505 | static void __exit afiucv_exit(void) |
| 2492 | { | 2506 | { |
| 2493 | if (pr_iucv) { | 2507 | if (pr_iucv) { |
| 2494 | device_unregister(af_iucv_dev); | 2508 | afiucv_iucv_exit(); |
| 2495 | driver_unregister(&af_iucv_driver); | ||
| 2496 | pr_iucv->iucv_unregister(&af_iucv_handler, 0); | ||
| 2497 | symbol_put(iucv_if); | 2509 | symbol_put(iucv_if); |
| 2498 | } else | 2510 | } |
| 2499 | unregister_netdevice_notifier(&afiucv_netdev_notifier); | 2511 | |
| 2512 | unregister_netdevice_notifier(&afiucv_netdev_notifier); | ||
| 2500 | dev_remove_pack(&iucv_packet_type); | 2513 | dev_remove_pack(&iucv_packet_type); |
| 2501 | sock_unregister(PF_IUCV); | 2514 | sock_unregister(PF_IUCV); |
| 2502 | proto_unregister(&iucv_proto); | 2515 | proto_unregister(&iucv_proto); |
