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>
This commit is contained in:
Jonghwan Choi 2012-01-14 11:06:03 +09:00 committed by Greg Kroah-Hartman
parent c56d8a7362
commit 2b31594a95

View file

@ -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) {