From: Jeff Dike Date: Thu, 29 Mar 2007 08:20:28 +0000 (-0700) Subject: [PATCH] uml: fix device unplug crash X-Git-Tag: firefly_0821_release~30475 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d40f6d71da81deb66c4fa54b46e22977cdb8b451;p=firefly-linux-kernel-4.4.55.git [PATCH] 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. Signed-off-by: Jeff Dike Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 178b2eff4a8c..65ad2932672c 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c @@ -615,6 +615,9 @@ void mconsole_remove(struct mc_request *req) 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";