diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-04-22 22:57:50 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-23 02:40:36 +0200 |
commit | 29591b92e19f409d5ad4c099c2b7b5ea56f50dfa (patch) | |
tree | 0e3625c691318934f97f384d0cac862b13b29719 /drivers/base/bus.c | |
parent | Relax check on adding children of suspended devices (diff) | |
download | linux-29591b92e19f409d5ad4c099c2b7b5ea56f50dfa.tar.xz linux-29591b92e19f409d5ad4c099c2b7b5ea56f50dfa.zip |
bus_remove_device: be more careful about incomplete initialization
Prevent bus_remove_device() from crashing if dev->knode_bus has not been
initialized before it's called.
This can happen if the device_add() ended up breaking out early due to
an error, for example.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index be1cc5143354..ef522ae55480 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -530,7 +530,8 @@ void bus_remove_device(struct device *dev) sysfs_remove_link(&dev->bus->p->devices_kset->kobj, dev->bus_id); device_remove_attrs(dev->bus, dev); - klist_del(&dev->knode_bus); + if (klist_node_attached(&dev->knode_bus)) + klist_del(&dev->knode_bus); pr_debug("bus: '%s': remove device %s\n", dev->bus->name, dev->bus_id); |