linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Unicorn Chang <uchang@tw.ibm.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: linux-ide@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH/RFC] libata: fix can't free irq 14 on legacy mode pata driver
Date: Tue, 11 Apr 2006 17:50:17 +0800	[thread overview]
Message-ID: <443B7BD9.4040901@tw.ibm.com> (raw)

-fix can't free irq 14 on legacy mode pata driver
-fix the ata_host_set_remove() memory leak problem

Signed-off-by: Unicorn Chang <uchang@tw.ibm.com>
---

keep all ata_host_set structure for free irq use on legacy mode pata
driver. 
(Patch against upstream branch)

using "rmmod pata_amd" and then "modprobe pata_amd" to produce bug and
same bug report by Krzysztof Halasa:
http://marc.theaimsgroup.com/?l=linux-kernel&m=114122847813360&w=2

--- a/drivers/scsi/libata-core.c	2006-04-10 16:30:46.718750000 +0800
+++ b/drivers/scsi/libata-core.c	2006-04-11 17:02:52.109375000 +0800
@@ -4794,6 +4794,8 @@ int ata_device_add(const struct ata_prob
 		ata_scsi_scan_host(ap);
 	}
 
+	/* don't lose last one, free irq will need it */
+	host_set->host_set_chain = dev_get_drvdata(dev);
 	dev_set_drvdata(dev, host_set);
 
 	VPRINTK("EXIT, returning %u\n", ent->n_ports);
@@ -4826,6 +4828,9 @@ void ata_host_set_remove(struct ata_host
 	struct ata_port *ap;
 	unsigned int i;
 
+	if(host_set->host_set_chain)
+		ata_host_set_remove(host_set->host_set_chain);
+	
 	for (i = 0; i < host_set->n_ports; i++) {
 		ap = host_set->ports[i];
 		scsi_remove_host(ap->host);
--- a/include/linux/libata.h	2006-04-10 16:32:06.656250000 +0800
+++ b/include/linux/libata.h	2006-04-10 17:51:19.812500000 +0800
@@ -304,6 +304,7 @@ struct ata_host_set {
 	int			simplex_claimed;	/* Keep seperate in case we
 							   ever need to do this locked */
 	struct ata_port *	ports[0];
+	struct ata_host_set	*host_set_chain;	/* Keep last host_set */
 };
 
 struct ata_queued_cmd { 



             reply	other threads:[~2006-04-11  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-11  9:50 Unicorn Chang [this message]
2006-04-11 10:42 ` [PATCH/RFC] libata: fix can't free irq 14 on legacy mode pata driver Albert Lee

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=443B7BD9.4040901@tw.ibm.com \
    --to=uchang@tw.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).