aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds
diff options
context:
space:
mode:
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/ib_cm.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index b5d0b60a26bc..73253f7c1fa3 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -428,7 +428,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
428 struct rds_ib_connection *ic = NULL; 428 struct rds_ib_connection *ic = NULL;
429 struct rdma_conn_param conn_param; 429 struct rdma_conn_param conn_param;
430 u32 version; 430 u32 version;
431 int err, destroy = 1; 431 int err = 1, destroy = 1;
432 432
433 /* Check whether the remote protocol version matches ours. */ 433 /* Check whether the remote protocol version matches ours. */
434 version = rds_ib_protocol_compatible(event); 434 version = rds_ib_protocol_compatible(event);
@@ -467,7 +467,6 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
467 /* Wait and see - our connect may still be succeeding */ 467 /* Wait and see - our connect may still be succeeding */
468 rds_ib_stats_inc(s_ib_connect_raced); 468 rds_ib_stats_inc(s_ib_connect_raced);
469 } 469 }
470 mutex_unlock(&conn->c_cm_lock);
471 goto out; 470 goto out;
472 } 471 }
473 472
@@ -504,16 +503,14 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
504 503
505 /* rdma_accept() calls rdma_reject() internally if it fails */ 504 /* rdma_accept() calls rdma_reject() internally if it fails */
506 err = rdma_accept(cm_id, &conn_param); 505 err = rdma_accept(cm_id, &conn_param);
507 mutex_unlock(&conn->c_cm_lock); 506 if (err)
508 if (err) {
509 rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err); 507 rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err);
510 goto out;
511 }
512
513 return 0;
514 508
515out: 509out:
516 rdma_reject(cm_id, NULL, 0); 510 if (conn)
511 mutex_unlock(&conn->c_cm_lock);
512 if (err)
513 rdma_reject(cm_id, NULL, 0);
517 return destroy; 514 return destroy;
518} 515}
519 516