]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
libata: clear drvdata in ata_host_release(), take#2
authorTejun Heo <htejun@gmail.com>
Tue, 27 Feb 2007 13:33:21 +0000 (22:33 +0900)
committerJeff Garzik <jeff@garzik.org>
Fri, 2 Mar 2007 01:16:28 +0000 (20:16 -0500)
Clearing drvdata in ->remove_one causes NULL pointer deference.  Clear
drvdata only in ata_host_release() after all resources are freed.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-core.c
drivers/ata/pata_cs5520.c
drivers/ata/pata_isapnp.c
drivers/ata/pata_platform.c

index c8d44a7c403fe1171d762e7cba511dfb2d97f383..17ad152714e6fe9ea5103f6e823bdc27dfd9e560 100644 (file)
@@ -5680,6 +5680,8 @@ static void ata_host_release(struct device *gendev, void *res)
 
        if (host->ops->host_stop)
                host->ops->host_stop(host);
+
+       dev_set_drvdata(gendev, NULL);
 }
 
 /**
@@ -5902,7 +5904,6 @@ int ata_device_add(const struct ata_probe_ent *ent)
 
  err_out:
        devres_release_group(dev, ata_device_add);
-       dev_set_drvdata(dev, NULL);
        VPRINTK("EXIT, returning %d\n", rc);
        return 0;
 }
index c1334c6c4156f6a6e4267731fdf29850f4d9a5d2..8ff2d58c599ed14e6b23a495bc08fe95e8968308 100644 (file)
@@ -306,7 +306,6 @@ static void __devexit cs5520_remove_one(struct pci_dev *pdev)
        struct ata_host *host = dev_get_drvdata(dev);
 
        ata_host_detach(host);
-       dev_set_drvdata(dev, NULL);
 }
 
 /**
index d5f2e85e28f326c1a57cd864727258acc0fb8772..1a61cc89174191cb65e9e8ef6474b6cf74b633d2 100644 (file)
@@ -128,7 +128,6 @@ static void isapnp_remove_one(struct pnp_dev *idev)
        struct ata_host *host = dev_get_drvdata(dev);
 
        ata_host_detach(host);
-       dev_set_drvdata(dev, NULL);
 }
 
 static struct pnp_device_id isapnp_devices[] = {
index 02ea95fcba694e85d9fc307047b7a7466203e392..4b82a5435a4ebfc1f558afa89bf088bb9d4dc565 100644 (file)
@@ -228,7 +228,6 @@ static int __devexit pata_platform_remove(struct platform_device *pdev)
        struct ata_host *host = dev_get_drvdata(dev);
 
        ata_host_detach(host);
-       dev_set_drvdata(dev, NULL);
 
        return 0;
 }