From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Lalancette Subject: [PATCH]: Unregister inetdev notifiers on failure Date: Fri, 27 Feb 2009 18:26:59 +0100 Message-ID: <49A82263.9050707@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070104000300030208020506" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------070104000300030208020506 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit (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 --------------070104000300030208020506 Content-Type: text/x-patch; name="xen-unregister-netfront-notifiers.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xen-unregister-netfront-notifiers.patch" 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(¬ifier_inetdev); #endif - return xenbus_register_frontend(&netfront_driver); + err = xenbus_register_frontend(&netfront_driver); + if (err) { +#ifdef CONFIG_INET + unregister_inetaddr_notifier(¬ifier_inetdev); +#endif + } + return err; } module_init(netif_init); --------------070104000300030208020506 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------070104000300030208020506--