public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix HBA removal problem with transport classes
@ 2005-02-01 20:50 James Bottomley
  0 siblings, 0 replies; only message in thread
From: James Bottomley @ 2005-02-01 20:50 UTC (permalink / raw)
  To: SCSI Mailing List

James Smart pointed out that if you insert and remove a HBA driver a few
times, eventually the system oopses.

The reason is that the transport classes all kfree their attribute
containers, but don't actually unregister them first (so we have freed
memory on the container list).  The attached should fix this.

James

===== drivers/scsi/scsi_transport_fc.c 1.15 vs edited =====
--- 1.15/drivers/scsi/scsi_transport_fc.c	2005-02-01 10:45:41 -06:00
+++ edited/drivers/scsi/scsi_transport_fc.c	2005-02-01 13:24:03 -06:00
@@ -846,6 +846,9 @@
 void fc_release_transport(struct scsi_transport_template *t)
 {
 	struct fc_internal *i = to_fc_internal(t);
+
+	attribute_container_unregister(&i->t.target_attrs);
+	attribute_container_unregister(&i->t.host_attrs);
 
 	kfree(i);
 }
===== drivers/scsi/scsi_transport_iscsi.c 1.3 vs edited =====
--- 1.3/drivers/scsi/scsi_transport_iscsi.c	2005-02-01 10:45:41 -06:00
+++ edited/drivers/scsi/scsi_transport_iscsi.c	2005-02-01 13:23:55 -06:00
@@ -356,6 +356,10 @@
 void iscsi_release_transport(struct scsi_transport_template *t)
 {
 	struct iscsi_internal *i = to_iscsi_internal(t);
+
+	attribute_container_unregister(&i->t.target_attrs);
+	attribute_container_unregister(&i->t.host_attrs);
+
 	kfree(i);
 }
 
===== drivers/scsi/scsi_transport_spi.c 1.24 vs edited =====
--- 1.24/drivers/scsi/scsi_transport_spi.c	2005-02-01 10:45:41 -06:00
+++ edited/drivers/scsi/scsi_transport_spi.c	2005-02-01 13:24:05 -06:00
@@ -921,6 +921,9 @@
 {
 	struct spi_internal *i = to_spi_internal(t);
 
+	attribute_container_unregister(&i->t.target_attrs);
+	attribute_container_unregister(&i->t.host_attrs);
+
 	kfree(i);
 }
 EXPORT_SYMBOL(spi_release_transport);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-01 20:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-01 20:50 [PATCH] fix HBA removal problem with transport classes James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox