]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: http://xenbits.xensource.com/linux-2.6.18-xen.hg?rev/86e119bc82c5 |
2 | # HG changeset 803 patch | |
3 | # User Keir Fraser <keir.fraser@citrix.com> | |
4 | # Date 1235992012 0 | |
5 | # Node ID 86e119bc82c5137e502bc8f68f65aba37f0a1a02 | |
6 | # Parent 979f8ccc314cd873e853fa9be6a72324c8ad119c | |
7 | Subject: netfront: Unregister inetdev notifiers on failure | |
8 | If you attempt to modprobe the pv-on-hvm netfront driver on a machine | |
9 | not running under Xen (say, bare-metal, or under another hypervisor), the | |
10 | netfront code correctly returns an ENODEV and fails to load. However, if you | |
11 | then shutdown that machine, you will oops while tearing down the network. | |
12 | This is because we forget to unregister the the inetaddr_notifier on failure, | |
13 | and so the kernel takes a fatal page fault. The attached patch just unregisters | |
14 | the notifier on failure, and solves the problem for me. | |
15 | ||
16 | Signed-off-by: Chris Lalancette <clalance@redhat.com> | |
17 | Acked-by: jbeulich@novell.com | |
18 | ||
19 | --- sle11-2009-03-04.orig/drivers/xen/netfront/netfront.c 2009-03-04 10:50:17.000000000 +0100 | |
20 | +++ sle11-2009-03-04/drivers/xen/netfront/netfront.c 2009-03-04 11:25:33.000000000 +0100 | |
21 | @@ -2199,6 +2199,8 @@ static struct xenbus_driver netfront_dri | |
22 | ||
23 | static int __init netif_init(void) | |
24 | { | |
25 | + int err; | |
26 | + | |
27 | if (!is_running_on_xen()) | |
28 | return -ENODEV; | |
29 | ||
30 | @@ -2220,7 +2222,13 @@ static int __init netif_init(void) | |
31 | (void)register_inetaddr_notifier(¬ifier_inetdev); | |
32 | #endif | |
33 | ||
34 | - return xenbus_register_frontend(&netfront_driver); | |
35 | + err = xenbus_register_frontend(&netfront_driver); | |
36 | + if (err) { | |
37 | +#ifdef CONFIG_INET | |
38 | + unregister_inetaddr_notifier(¬ifier_inetdev); | |
39 | +#endif | |
40 | + } | |
41 | + return err; | |
42 | } | |
43 | module_init(netif_init); | |
44 |