Commit ad5b0ac2 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Kamal Mostafa

iser-target: Fix possible deadlock in RDMA_CM connection error

commit 4a579da2 upstream.

Before we reach to connection established we may get an
error event. In this case the core won't teardown this
connection (never established it), so we take care of freeing
it ourselves.
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent c1fe6f74
......@@ -206,7 +206,7 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn)
static void
isert_free_rx_descriptors(struct isert_conn *isert_conn)
{
struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
struct ib_device *ib_dev = isert_conn->conn_device->ib_device;
struct iser_rx_desc *rx_desc;
int i;
......@@ -629,8 +629,8 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
static void
isert_connect_release(struct isert_conn *isert_conn)
{
struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
struct isert_device *device = isert_conn->conn_device;
struct ib_device *ib_dev = device->ib_device;
int cq_index;
pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
......@@ -639,7 +639,8 @@ isert_connect_release(struct isert_conn *isert_conn)
isert_conn_free_frwr_pool(isert_conn);
isert_free_rx_descriptors(isert_conn);
rdma_destroy_id(isert_conn->conn_cm_id);
if (isert_conn->conn_cm_id)
rdma_destroy_id(isert_conn->conn_cm_id);
if (isert_conn->conn_qp) {
cq_index = ((struct isert_cq_desc *)
......@@ -794,12 +795,15 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
return 0;
}
static void
static int
isert_connect_error(struct rdma_cm_id *cma_id)
{
struct isert_conn *isert_conn = cma_id->qp->qp_context;
isert_conn->conn_cm_id = NULL;
isert_put_conn(isert_conn);
return -1;
}
static int
......@@ -829,7 +833,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */
case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */
case RDMA_CM_EVENT_CONNECT_ERROR:
isert_connect_error(cma_id);
ret = isert_connect_error(cma_id);
break;
default:
pr_err("Unhandled RDMA CMA event: %d\n", event->event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment