mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Dillow <dillowda@ornl.gov>
To: Roland Dreier <rdreier@cisco.com>
Cc: torvalds@linux-foundation.org, general@lists.openfabrics.org,
	linux-kernel@vger.kernel.org
Subject: Re: [GIT PULL] please pull infiniband.git for-linus
Date: Thu, 03 Jan 2008 15:20:09 -0500	[thread overview]
Message-ID: <1199391609.7561.46.camel@lap75545.ornl.gov> (raw)
In-Reply-To: <1199391187.7561.38.camel@lap75545.ornl.gov>

Subject: IB/srp: Fix list corruption/oops on module reload

ib_srp doesn't clean up the transport attributes properly when
unloading, so it leaves references around to free'd memory.

The srp_remove_host() cannot go before the scsi_remove_host() call as
the documented call sequence suggests, as it will cause an oops when the
SRP transport code will free up an object that is not its own. So,
temporarily reorder the calls in srp_remove_work() to avoid the problem
as well until the transport code can be fixed.

Signed-off-by: David Dillow <dillowda@ornl.gov>
---
On Thu, 2008-01-03 at 15:13 -0500, David Dillow wrote:
> I'll send a new patch to you for just the ib_srp.c side.

Should've just sent it with the last email.

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 950228f..6e7e3c8 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -423,8 +423,8 @@ static void srp_remove_work(struct work_struct *work)
 	list_del(&target->list);
 	spin_unlock(&target->srp_host->target_lock);
 
-	srp_remove_host(target->scsi_host);
 	scsi_remove_host(target->scsi_host);
+	srp_remove_host(target->scsi_host);
 	ib_destroy_cm_id(target->cm_id);
 	srp_free_target_ib(target);
 	scsi_host_put(target->scsi_host);
@@ -2054,6 +2054,7 @@ static void srp_remove_one(struct ib_device *device)
 		list_for_each_entry_safe(target, tmp_target,
 					 &host->target_list, list) {
 			scsi_remove_host(target->scsi_host);
+			srp_remove_host(target->scsi_host);
 			srp_disconnect_target(target);
 			ib_destroy_cm_id(target->cm_id);
 			srp_free_target_ib(target);



  reply	other threads:[~2008-01-03 20:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03 18:29 Roland Dreier
2008-01-03 18:39 ` David Dillow
2008-01-03 18:56   ` Roland Dreier
2008-01-03 20:13     ` David Dillow
2008-01-03 20:20       ` David Dillow [this message]
2008-01-03 21:34         ` Roland Dreier
2008-01-03 23:11         ` Rik van Riel
2008-01-03 23:18           ` Dave Dillow
  -- strict thread matches above, loose matches on Subject: below --
2007-10-13 21:17 Roland Dreier
2007-10-12  1:08 Roland Dreier
2007-10-12  1:17 ` David Miller
2007-10-12  2:58   ` Linus Torvalds
2007-10-12  3:28     ` David Miller
2007-10-12  3:52     ` Greg KH
2007-10-12  4:03       ` Linus Torvalds
2007-10-12 12:58     ` Jeff Garzik
2007-10-13  1:10   ` Andrew Morton

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=1199391609.7561.46.camel@lap75545.ornl.gov \
    --to=dillowda@ornl.gov \
    --cc=general@lists.openfabrics.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®