LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-ide@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Komuro <komurojun-mbn@nifty.com>
Subject: [PATCH] libata: clear drvdata in ata_host_release(), take#2
Date: Tue, 27 Feb 2007 22:33:21 +0900 [thread overview]
Message-ID: <20070227133321.GH20322@htj.dyndns.org> (raw)
In-Reply-To: <45E0EB9F.3050001@garzik.org>
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>
---
pata_pcmcia is fixed by Alan's patch. This fixes other drivers and
make libata always clear drvdata after detach.
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index bdde327..3bdb509 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)
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;
}
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index c1334c6..8ff2d58 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)
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host);
- dev_set_drvdata(dev, NULL);
}
/**
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index d5f2e85..1a61cc8 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)
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host);
- dev_set_drvdata(dev, NULL);
}
static struct pnp_device_id isapnp_devices[] = {
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 02ea95f..4b82a54 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)
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host);
- dev_set_drvdata(dev, NULL);
return 0;
}
next prev parent reply other threads:[~2007-02-27 13:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070224074823.GA20322@htj.dyndns.org>
2007-02-25 1:51 ` [PATCH] libata: clear drvdata in ata_host_release() Jeff Garzik
2007-02-25 13:28 ` Alan
2007-02-27 13:33 ` Tejun Heo [this message]
2007-03-02 1:16 ` [PATCH] libata: clear drvdata in ata_host_release(), take#2 Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070227133321.GH20322@htj.dyndns.org \
--to=htejun@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jeff@garzik.org \
--cc=komurojun-mbn@nifty.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: [PATCH] libata: clear drvdata in ata_host_release(), take#2' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).