WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]: Unregister inetdev notifiers on failure

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH]: Unregister inetdev notifiers on failure
From: Chris Lalancette <clalance@xxxxxxxxxx>
Date: Fri, 27 Feb 2009 18:26:59 +0100
Delivery-date: Fri, 27 Feb 2009 09:29:19 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.19 (X11/20090105)
(Kier, I'm not sure if you are still accepting patches for the
linux-2.6.18-xen.hg tree, but if so...)

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@xxxxxxxxxx>
diff --git a/drivers/xen/netfront/netfront.c b/drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c
+++ b/drivers/xen/netfront/netfront.c
@@ -2199,6 +2199,8 @@ static struct xenbus_driver netfront_dri
 
 static int __init netif_init(void)
 {
+       int err;
+
        if (!is_running_on_xen())
                return -ENODEV;
 
@@ -2220,7 +2222,13 @@ static int __init netif_init(void)
        (void)register_inetaddr_notifier(&notifier_inetdev);
 #endif
 
-       return xenbus_register_frontend(&netfront_driver);
+       err = xenbus_register_frontend(&netfront_driver);
+       if (err) {
+#ifdef CONFIG_INET
+               unregister_inetaddr_notifier(&notifier_inetdev);
+#endif
+       }
+       return err;
 }
 module_init(netif_init);
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH]: Unregister inetdev notifiers on failure, Chris Lalancette <=