Skip to contentSkip to conversation

UML - Fix device unplug crash

PATCH In review Jeff Dike 1 participant 1 message Mar 27, 2007 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 3/6 UML - Fix device unplug crash

Fix a NULL dereference when unplugging a device. The default value of err_msg wants to be "" in case the driver doesn't modify it.

--

 arch/um/drivers/mconsole_kern.c |    3 +++
 1 file changed, 3 insertions(+)
arch/um/drivers/mconsole_kern.c +3 -0
Index: linux-2.6.21-mm/arch/um/drivers/mconsole_kern.c
===================================================================
@@ -614,6 +614,9 @@ void mconsole_remove(struct mc_request *
 	err_msg = NULL;
 	err = (*dev->remove)(n, &err_msg);
 	switch(err){
+	case 0:
+		err_msg = "";
+		break;
 	case -ENODEV:
 		if(err_msg == NULL)
 			err_msg = "Device doesn't exist";