Skip to content

Commit

Permalink
driver-core: Fix possible null reference in subsys_interface_unregister
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonghwan Choi authored and Greg Kroah-Hartman committed Jan 24, 2012
1 parent c56d8a7 commit 2b31594
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/base/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2b31594

Please sign in to comment.