ia64/linux-2.6.18-xen.hg

changeset 803:86e119bc82c5

netfront: Unregister inetdev notifiers on failure
If you attempt to modprobe the pv-on-hvm netfront driver on a machine
not running under Xen (say, bare-metal, or under another hypervisor), the
netfront code correctly returns an ENODEV and fails to load. However, if you
then shutdown that machine, you will oops while tearing down the network.
This is because we forget to unregister the the inetaddr_notifier on failure,
and so the kernel takes a fatal page fault. The attached patch just unregisters
the notifier on failure, and solves the problem for me.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 02 11:06:52 2009 +0000 (2009-03-02)
parents 979f8ccc314c
children f3de83c4677f
files drivers/xen/netfront/netfront.c
line diff
     1.1 --- a/drivers/xen/netfront/netfront.c	Mon Mar 02 11:02:00 2009 +0000
     1.2 +++ b/drivers/xen/netfront/netfront.c	Mon Mar 02 11:06:52 2009 +0000
     1.3 @@ -2199,6 +2199,8 @@ static struct xenbus_driver netfront_dri
     1.4  
     1.5  static int __init netif_init(void)
     1.6  {
     1.7 +	int err;
     1.8 +
     1.9  	if (!is_running_on_xen())
    1.10  		return -ENODEV;
    1.11  
    1.12 @@ -2220,7 +2222,13 @@ static int __init netif_init(void)
    1.13  	(void)register_inetaddr_notifier(&notifier_inetdev);
    1.14  #endif
    1.15  
    1.16 -	return xenbus_register_frontend(&netfront_driver);
    1.17 +	err = xenbus_register_frontend(&netfront_driver);
    1.18 +	if (err) {
    1.19 +#ifdef CONFIG_INET
    1.20 +		unregister_inetaddr_notifier(&notifier_inetdev);
    1.21 +#endif
    1.22 +	}
    1.23 +	return err;
    1.24  }
    1.25  module_init(netif_init);
    1.26