From 2b31594a9523449b168946725689d039c80204de Mon Sep 17 00:00:00 2001 From: Jonghwan Choi Date: Sat, 14 Jan 2012 11:06:03 +0900 Subject: [PATCH] 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 --- drivers/base/bus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) { -- 2.20.1