[ofa-general] [2.6.24-rc BUGFIX] IB/srp: release transport when removing host

Dave Dillow dillowda at ornl.gov
Thu Jan 3 18:39:19 PST 2008


When removing the ib_srp module, srp_remove_one() does not release the
SRP transport class when it is releasing the SCSI host. This leads to
dangling references to kfree()'d memory, and an eventual oops.

Signed-off-by: David Dillow <dillowda at ornl.gov>
---
On Fri, 2008-01-04 at 09:47 +0900, FUJITA Tomonori wrote:
> I think that this is the root problem and the patch fixes it in the
> right way. Please send this patch to linux-scsi at vger.kernel.org and a
> patch to move srp_remove_host before scsi_remove_host in
> srp_remove_one to Roland.
> 
> Acked-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>

Not sure if your Acked-by was for this one as well, so I left it off.

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 950228f..bdb6f85 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2053,6 +2053,7 @@ static void srp_remove_one(struct ib_device *device)
 
 		list_for_each_entry_safe(target, tmp_target,
 					 &host->target_list, list) {
+			srp_remove_host(target->scsi_host);
 			scsi_remove_host(target->scsi_host);
 			srp_disconnect_target(target);
 			ib_destroy_cm_id(target->cm_id);




More information about the general mailing list