aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnil Veerabhadrappa <anilgv@broadcom.com>2009-07-30 00:50:11 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:52:12 -0400
commitc19dcd011238118ad07d3ab7ed1bbc4916826324 (patch)
tree93c100d928f16f5ebd522e73c6ef43877f21a9a1
parent534cc9c165017dd29ae0f4458832893dc8033c6f (diff)
[SCSI] bnx2i : Fix "cid #n not valid" issue
When bnx2i_adapter_ready() fails, connection handle(cid) = 0 is wrongly freed because 'cid' is not yet allocated for the endpoint. Fix is to initialize bnx2i_ep->ep_iscsi_cid to '-1' in bnx2i_alloc_ep() and not in bnx2i_ep_connect() to avoid releasing invalid 'cid'. There is already a check in bnx2i_free_iscsi_cid() not to free invalid iscsi connection handle (-1) Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 40120a242eff..9a7ba71f1af4 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -387,6 +387,7 @@ static struct iscsi_endpoint *bnx2i_alloc_ep(struct bnx2i_hba *hba)
387 bnx2i_ep = ep->dd_data; 387 bnx2i_ep = ep->dd_data;
388 INIT_LIST_HEAD(&bnx2i_ep->link); 388 INIT_LIST_HEAD(&bnx2i_ep->link);
389 bnx2i_ep->state = EP_STATE_IDLE; 389 bnx2i_ep->state = EP_STATE_IDLE;
390 bnx2i_ep->ep_iscsi_cid = (u16) -1;
390 bnx2i_ep->hba = hba; 391 bnx2i_ep->hba = hba;
391 bnx2i_ep->hba_age = hba->age; 392 bnx2i_ep->hba_age = hba->age;
392 hba->ofld_conns_active++; 393 hba->ofld_conns_active++;
@@ -1681,8 +1682,6 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
1681 goto net_if_down; 1682 goto net_if_down;
1682 } 1683 }
1683 1684
1684 bnx2i_ep->state = EP_STATE_IDLE;
1685 bnx2i_ep->ep_iscsi_cid = (u16) -1;
1686 bnx2i_ep->num_active_cmds = 0; 1685 bnx2i_ep->num_active_cmds = 0;
1687 iscsi_cid = bnx2i_alloc_iscsi_cid(hba); 1686 iscsi_cid = bnx2i_alloc_iscsi_cid(hba);
1688 if (iscsi_cid == -1) { 1687 if (iscsi_cid == -1) {