]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
IB/srp: Fix crash in srp_reconnect_target
authorIshai Rabinovitz <ishai@mellanox.co.il>
Tue, 25 Jul 2006 16:54:09 +0000 (19:54 +0300)
committerRoland Dreier <rolandd@cisco.com>
Thu, 3 Aug 2006 16:44:22 +0000 (09:44 -0700)
Protect against srp_reset_device() clearing the req_queue while
srp_reconnect_target() is in progress (note that state change at
the top of srp_reconnect_target() is not sufficient for this since
srp_reset_device() ignores the state).

Signed-off-by: Ishai Rabinovitz <ishai@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/srp/ib_srp.c

index 8f472e7113b41afcd4b35f35a0ea7ae0f55d93fe..ff94e4e326913f828a254950a4661ecee45a6d77 100644 (file)
@@ -526,8 +526,10 @@ static int srp_reconnect_target(struct srp_target_port *target)
        while (ib_poll_cq(target->cq, 1, &wc) > 0)
                ; /* nothing */
 
+       spin_lock_irq(target->scsi_host->host_lock);
        list_for_each_entry_safe(req, tmp, &target->req_queue, list)
                srp_reset_req(target, req);
+       spin_unlock_irq(target->scsi_host->host_lock);
 
        target->rx_head  = 0;
        target->tx_head  = 0;