Skip to contentSkip to conversation

fix HBA removal problem with transport classes

PATCH New James Bottomley 1 participant 1 message Feb 1, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix HBA removal problem with transport classes

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 =====

drivers/scsi/scsi_transport_fc.c +3 -0
@@ -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 =====

drivers/scsi/scsi_transport_iscsi.c +4 -0
@@ -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 =====

drivers/scsi/scsi_transport_spi.c +3 -0
@@ -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);