All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libata: fix probe_ent free in ata_sas_port_alloc()
@ 2007-02-17 14:27 Tejun Heo
  2007-02-17 15:16 ` James Bottomley
  0 siblings, 1 reply; 9+ messages in thread
From: Tejun Heo @ 2007-02-17 14:27 UTC (permalink / raw)
  To: Jeff Garzik, James Bottomley; +Cc: linux-ide, SCSI Mailing List

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);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-02-20 15:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-17 14:27 [PATCH] libata: fix probe_ent free in ata_sas_port_alloc() Tejun Heo
2007-02-17 15:16 ` 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

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.