diff options
author | Jonghwan Choi <jhbird.choi@samsung.com> | 2012-01-14 06:06:03 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-25 03:59:19 +0400 |
commit | 2b31594a9523449b168946725689d039c80204de (patch) | |
tree | 001cae76042df01ea712e198b62a533a0a6886a5 | |
parent | c56d8a7362665d165ba992b6b7a8d6c13a26eafc (diff) | |
download | linux-2b31594a9523449b168946725689d039c80204de.tar.xz |
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 <jhbird.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/base/bus.c | 6 |
1 files 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) { |