Re: PCI driver module unload race?

From: Oliver Neukum (oliver@neukum.name)
Date: Mon Mar 10 2003 - 18:48:43 EST


> diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
> --- a/drivers/base/bus.c Mon Mar 10 13:52:15 2003
> +++ b/drivers/base/bus.c Mon Mar 10 13:52:15 2003
> @@ -263,14 +263,25 @@
> if (dev->bus->match(dev,drv)) {
> dev->driver = drv;
> if (drv->probe) {
> - if ((error = drv->probe(dev))) {

It seems that the semaphore in bus_add_device() makes this unnecessary.

[..]
> diff -Nru a/drivers/base/power.c b/drivers/base/power.c
> --- a/drivers/base/power.c Mon Mar 10 13:52:15 2003
> +++ b/drivers/base/power.c Mon Mar 10 13:52:15 2003
> @@ -41,10 +41,17 @@
> list_for_each(node,&devices_subsys.kset.list) {
> struct device * dev = to_dev(node);
> if (dev->driver && dev->driver->suspend) {
> - pr_debug("suspending device %s\n",dev->name);
> - error = dev->driver->suspend(dev,state,level);

This change is no good.
Either the semaphore protects you or it doesn't. If it doesn't you can't
even trust the dev pointer, because suspend() can sleep.

        Regards
                Oliver

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:23 EST