linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jeff@garzik.org>,
	James Bottomley <James.Bottomley@SteelEye.com>
Cc: "linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] libata: fix probe_ent free in ata_sas_port_alloc()
Date: Sat, 17 Feb 2007 23:27:52 +0900	[thread overview]
Message-ID: <45D710E8.3090104@gmail.com> (raw)

probe_ent is allocated using devm_kzalloc() and thus should be freed
using devm_kfree().  ata_sas_port_alloc() freed its probe_ent using
kfree() thus causing double free later.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
James, does this fix the bug you mentioned on IRC?

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 0009818..e5e19e3 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3234,7 +3234,7 @@ struct ata_port *ata_sas_port_alloc(struct ata_host *host,
 
 	ata_port_init(ap, host, ent, 0);
 	ap->lock = shost->host_lock;
-	kfree(ent);
+	devm_kfree(host->dev, ent);
 	return ap;
 }
 EXPORT_SYMBOL_GPL(ata_sas_port_alloc);

             reply	other threads:[~2007-02-17 14:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-17 14:27 Tejun Heo [this message]
2007-02-17 15:16 ` [PATCH] libata: fix probe_ent free in ata_sas_port_alloc() James Bottomley
2007-02-17 17:24   ` [PATCH] libata: fix probe_ent alloc/free bugs Tejun Heo
2007-02-17 17:43     ` Sergei Shtylyov
2007-02-17 18:19       ` James Bottomley
2007-02-17 18:27         ` Sergei Shtylyov
2007-02-17 18:09     ` James Bottomley
2007-02-20  8:37     ` Tejun Heo
2007-02-20 15:52     ` 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=45D710E8.3090104@gmail.com \
    --to=htejun@gmail.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@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).