public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] fix HBA removal problem with transport classes
Date: Tue, 01 Feb 2005 14:50:02 -0600	[thread overview]
Message-ID: <1107291002.4800.67.camel@mulgrave> (raw)

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



                 reply	other threads:[~2005-02-01 20:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1107291002.4800.67.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --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