diff options
author | Tejun Heo <htejun@gmail.com> | 2007-02-27 08:33:21 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-03-01 20:16:28 -0500 |
commit | 1aa56cca5bfa396c791e93b38e4776ef39b590a7 (patch) | |
tree | c4e88e2195dfc1db88c932e5c2b9adb151bb9d65 /drivers | |
parent | 7b965e0884cee430ffe5dc81cdb117b9316b0549 (diff) |
libata: clear drvdata in ata_host_release(), take#2
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/libata-core.c | 3 | ||||
-rw-r--r-- | drivers/ata/pata_cs5520.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_isapnp.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_platform.c | 1 |
4 files changed, 2 insertions, 4 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c8d44a7c403f..17ad152714e6 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -5680,6 +5680,8 @@ static void ata_host_release(struct device *gendev, void *res) | |||
5680 | 5680 | ||
5681 | if (host->ops->host_stop) | 5681 | if (host->ops->host_stop) |
5682 | host->ops->host_stop(host); | 5682 | host->ops->host_stop(host); |
5683 | |||
5684 | dev_set_drvdata(gendev, NULL); | ||
5683 | } | 5685 | } |
5684 | 5686 | ||
5685 | /** | 5687 | /** |
@@ -5902,7 +5904,6 @@ int ata_device_add(const struct ata_probe_ent *ent) | |||
5902 | 5904 | ||
5903 | err_out: | 5905 | err_out: |
5904 | devres_release_group(dev, ata_device_add); | 5906 | devres_release_group(dev, ata_device_add); |
5905 | dev_set_drvdata(dev, NULL); | ||
5906 | VPRINTK("EXIT, returning %d\n", rc); | 5907 | VPRINTK("EXIT, returning %d\n", rc); |
5907 | return 0; | 5908 | return 0; |
5908 | } | 5909 | } |
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index c1334c6c4156..8ff2d58c599e 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
@@ -306,7 +306,6 @@ static void __devexit cs5520_remove_one(struct pci_dev *pdev) | |||
306 | struct ata_host *host = dev_get_drvdata(dev); | 306 | struct ata_host *host = dev_get_drvdata(dev); |
307 | 307 | ||
308 | ata_host_detach(host); | 308 | ata_host_detach(host); |
309 | dev_set_drvdata(dev, NULL); | ||
310 | } | 309 | } |
311 | 310 | ||
312 | /** | 311 | /** |
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index d5f2e85e28f3..1a61cc891741 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c | |||
@@ -128,7 +128,6 @@ static void isapnp_remove_one(struct pnp_dev *idev) | |||
128 | struct ata_host *host = dev_get_drvdata(dev); | 128 | struct ata_host *host = dev_get_drvdata(dev); |
129 | 129 | ||
130 | ata_host_detach(host); | 130 | ata_host_detach(host); |
131 | dev_set_drvdata(dev, NULL); | ||
132 | } | 131 | } |
133 | 132 | ||
134 | static struct pnp_device_id isapnp_devices[] = { | 133 | static struct pnp_device_id isapnp_devices[] = { |
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 02ea95fcba69..4b82a5435a4e 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
@@ -228,7 +228,6 @@ static int __devexit pata_platform_remove(struct platform_device *pdev) | |||
228 | struct ata_host *host = dev_get_drvdata(dev); | 228 | struct ata_host *host = dev_get_drvdata(dev); |
229 | 229 | ||
230 | ata_host_detach(host); | 230 | ata_host_detach(host); |
231 | dev_set_drvdata(dev, NULL); | ||
232 | 231 | ||
233 | return 0; | 232 | return 0; |
234 | } | 233 | } |