All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancockr@shaw.ca>
To: Jeff Garzik <jeff@garzik.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	linux-ide@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: [PATCH -mm] sata_nv: fix kfree ordering in remove
Date: Mon, 11 Dec 2006 23:34:34 -0600	[thread overview]
Message-ID: <457E3F6A.809@shaw.ca> (raw)
In-Reply-To: <457D86F0.4020408@garzik.org>

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

Jeff Garzik wrote:
> It is unwise to free the struct before the ports are even detached.

Right, theoretically something bad could happen here (though not 
likely). Here's a fix. Sorry for attaching with something so trivial, 
but Thunderbird isn't very cooperative..

---

The suspend/resume change for sata_nv introduced a potential bug where 
the hpriv structure could be used after it was freed in nv_remove_one. 
Fix that.

Signed-off-by: Robert Hancock <hancockr@shaw.ca>

---
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/

[-- Attachment #2: sata_nv-fix-kfree-order-on-remove.patch --]
[-- Type: text/plain, Size: 466 bytes --]

--- linux-2.6.19-rc6-mm2/drivers/ata/sata_nv.c	2006-12-11 22:13:26.000000000 -0600
+++ linux-2.6.19-rc6-mm2admafix/drivers/ata/sata_nv.c	2006-12-11 22:15:58.000000000 -0600
@@ -1555,8 +1555,8 @@ static void nv_remove_one (struct pci_de
 	struct ata_host *host = dev_get_drvdata(&pdev->dev);
 	struct nv_host_priv *hpriv = host->private_data;
 	
-	kfree(hpriv);
 	ata_pci_remove_one(pdev);
+	kfree(hpriv);
 }	
 
 static int nv_pci_device_resume(struct pci_dev *pdev)

  reply	other threads:[~2006-12-12  5:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30  2:15 [PATCH -mm] sata_nv: add suspend/resume support Robert Hancock
2006-12-11 16:27 ` Jeff Garzik
2006-12-12  5:34   ` Robert Hancock [this message]
2006-12-12 11:35     ` [PATCH -mm] sata_nv: fix kfree ordering in remove 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=457E3F6A.809@shaw.ca \
    --to=hancockr@shaw.ca \
    --cc=akpm@osdl.org \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.