Skip to content

Commit

Permalink
IB/iser: Fix error flow in iser ep connection establishment
Browse files Browse the repository at this point in the history
The current error flow code was releasing the IB connection object and
calling iscsi_destroy_endpoint() directly without going through the
reference counting mechanism introduced in commit 39ff05d ("IB/iser:
Enhance disconnection logic for multi-pathing"). This resulted in a
double free of the iscsi endpoint object, which causes a kernel NULL
pointer dereference.  Fix that by plugging into the IB conn reference
counting correctly.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information
Or Gerlitz authored and Roland Dreier committed May 19, 2012
1 parent d48b97b commit 7d9c0de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions drivers/infiniband/ulp/iser/iscsi_iser.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,9 @@ iscsi_iser_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,

err = iser_connect(ib_conn, NULL, (struct sockaddr_in *)dst_addr,
non_blocking);
if (err) {
iscsi_destroy_endpoint(ep);
if (err)
return ERR_PTR(err);
}

return ep;
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/infiniband/ulp/iser/iser_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,9 @@ int iser_connect(struct iser_conn *ib_conn,
ib_conn->cma_id = NULL;
addr_failure:
ib_conn->state = ISER_CONN_DOWN;
iser_conn_put(ib_conn, 1); /* deref ib conn's cma id */
connect_failure:
iser_conn_release(ib_conn, 1);
iser_conn_put(ib_conn, 1); /* deref ib conn deallocate */
return err;
}

Expand Down

0 comments on commit 7d9c0de

Please sign in to comment.