Skip to contentSkip to conversation

Patch "drivers: hv: Don't OOPS when you cannot init vmbus" has been added to the 3.2-stable tree

PATCH [email protected] 1 participant 1 message Jan 10, 2012

Subsystems (2)
lore
Share & tools
lore

[email protected]

author Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drivers: hv: Don't OOPS when you cannot init vmbus

to the 3.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drivers-hv-don-t-oops-when-you-cannot-init-vmbus.patch
and it can be found in the queue-3.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From cf6a2eacbcb2593b5b91d0817915c4f0464bb534 Mon Sep 17 00:00:00 2001

From: "K. Y. Srinivasan" <[email protected]>
Date: Thu, 1 Dec 2011 09:59:34 -0800
Subject: drivers: hv: Don't OOPS when you cannot init vmbus

From: "K. Y. Srinivasan" <[email protected]>

commit cf6a2eacbcb2593b5b91d0817915c4f0464bb534 upstream.

The hv vmbus driver was causing an OOPS since it was trying to register drivers on top of the bus even if initialization of the bus has failed for some reason (such as the odd chance someone would run a hv enabled kernel in a non-hv environment).

---
 drivers/hv/vmbus_drv.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/hv/vmbus_drv.c +16 -0
@@ -62,6 +62,14 @@ struct hv_device_info {
 	struct hv_dev_port_info outbound;
 };
 
+static int vmbus_exists(void)
+{
+	if (hv_acpi_dev == NULL)
+		return -ENODEV;
+
+	return 0;
+}
+
 
 static void get_channel_info(struct hv_device *device,
 			     struct hv_device_info *info)
@@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_dr
 
 	pr_info("registering driver %s\n", hv_driver->name);
 
+	ret = vmbus_exists();
+	if (ret < 0)
+		return ret;
+
 	hv_driver->driver.name = hv_driver->name;
 	hv_driver->driver.owner = owner;
 	hv_driver->driver.mod_name = mod_name;
@@ -614,6 +626,9 @@ void vmbus_driver_unregister(struct hv_d
 {
 	pr_info("unregistering driver %s\n", hv_driver->name);
 
+	if (!vmbus_exists())
+		return;
+
 	driver_unregister(&hv_driver->driver);
 
 }
@@ -776,6 +791,7 @@ static int __init hv_acpi_init(void)
 
 cleanup:
 	acpi_bus_unregister_driver(&vmbus_acpi_driver);
+	hv_acpi_dev = NULL;
 	return ret;
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-3.2/drivers-hv-don-t-oops-when-you-cannot-init-vmbus.patch queue-3.2/drivers-hv-fix-a-bug-in-vmbus_driver_unregister.patch