mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
RDS/IB: rds_ib_cm_handle_connect() forgot to unlock c_cm_lock
rds_ib_cm_handle_connect() could return without unlocking the c_conn_lock if rds_setup_qp() failed. Rather than adding another imbalanced mutex_unlock() to this error path we only unlock the mutex once as we exit the function, reducing the likelyhood of making this same mistake in the future. We remove the previous mulitple return sites, leaving one unambigious return path. Signed-off-by: Zach Brown <zach.brown@oracle.com>
This commit is contained in:
parent
1cc2228c59
commit
a46ca94e7f
1 changed files with 6 additions and 9 deletions
|
@ -428,7 +428,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
|
||||||
struct rds_ib_connection *ic = NULL;
|
struct rds_ib_connection *ic = NULL;
|
||||||
struct rdma_conn_param conn_param;
|
struct rdma_conn_param conn_param;
|
||||||
u32 version;
|
u32 version;
|
||||||
int err, destroy = 1;
|
int err = 1, destroy = 1;
|
||||||
|
|
||||||
/* Check whether the remote protocol version matches ours. */
|
/* Check whether the remote protocol version matches ours. */
|
||||||
version = rds_ib_protocol_compatible(event);
|
version = rds_ib_protocol_compatible(event);
|
||||||
|
@ -467,7 +467,6 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
|
||||||
/* Wait and see - our connect may still be succeeding */
|
/* Wait and see - our connect may still be succeeding */
|
||||||
rds_ib_stats_inc(s_ib_connect_raced);
|
rds_ib_stats_inc(s_ib_connect_raced);
|
||||||
}
|
}
|
||||||
mutex_unlock(&conn->c_cm_lock);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,15 +503,13 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
|
||||||
|
|
||||||
/* rdma_accept() calls rdma_reject() internally if it fails */
|
/* rdma_accept() calls rdma_reject() internally if it fails */
|
||||||
err = rdma_accept(cm_id, &conn_param);
|
err = rdma_accept(cm_id, &conn_param);
|
||||||
mutex_unlock(&conn->c_cm_lock);
|
if (err)
|
||||||
if (err) {
|
|
||||||
rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err);
|
rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err);
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
if (conn)
|
||||||
|
mutex_unlock(&conn->c_cm_lock);
|
||||||
|
if (err)
|
||||||
rdma_reject(cm_id, NULL, 0);
|
rdma_reject(cm_id, NULL, 0);
|
||||||
return destroy;
|
return destroy;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue