summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonghwan Choi <jhbird.choi@samsung.com>2012-01-14 11:06:03 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-24 15:59:19 -0800
commit2b31594a9523449b168946725689d039c80204de (patch)
tree001cae76042df01ea712e198b62a533a0a6886a5
parentc56d8a7362665d165ba992b6b7a8d6c13a26eafc (diff)
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.c6
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) {