From: Jonghwan Choi Date: Sat, 14 Jan 2012 02:06:03 +0000 (+0900) Subject: driver-core: Fix possible null reference in subsys_interface_unregister X-Git-Tag: MMI-PSA29.97-13-9~17269^2~57 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2b31594a9523449b168946725689d039c80204de;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git driver-core: Fix possible null reference in subsys_interface_unregister Check if the sif is not NULL before de-referencing it Signed-off-by: Jonghwan Choi Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 99dc5921e1dd..4ddb38b696fe 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -1193,13 +1193,15 @@ EXPORT_SYMBOL_GPL(subsys_interface_register); void subsys_interface_unregister(struct subsys_interface *sif) { - struct bus_type *subsys = sif->subsys; + struct bus_type *subsys; struct subsys_dev_iter iter; struct device *dev; - if (!sif) + if (!sif || !sif->subsys) return; + subsys = sif->subsys; + mutex_lock(&subsys->p->mutex); list_del_init(&sif->node); if (sif->remove_dev) {