Commit ae05368a authored by santosh.shilimkar@oracle.com's avatar santosh.shilimkar@oracle.com Committed by David S. Miller

RDS: check for valid cm_id before initiating connection

Connection could have been dropped while the route is being resolved
so check for valid cm_id before initiating the connection.
Reviewed-by: default avatarAjaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Signed-off-by: default avatarSantosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 06e8941e
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <rdma/rdma_cm.h> #include <rdma/rdma_cm.h>
#include "rdma_transport.h" #include "rdma_transport.h"
#include "ib.h"
static struct rdma_cm_id *rds_rdma_listen_id; static struct rdma_cm_id *rds_rdma_listen_id;
...@@ -82,8 +83,18 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id, ...@@ -82,8 +83,18 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
break; break;
case RDMA_CM_EVENT_ROUTE_RESOLVED: case RDMA_CM_EVENT_ROUTE_RESOLVED:
/* XXX worry about racing with listen acceptance */ /* Connection could have been dropped so make sure the
* cm_id is valid before proceeding
*/
if (conn) {
struct rds_ib_connection *ibic;
ibic = conn->c_transport_data;
if (ibic && ibic->i_cm_id == cm_id)
ret = trans->cm_initiate_connect(cm_id); ret = trans->cm_initiate_connect(cm_id);
else
rds_conn_drop(conn);
}
break; break;
case RDMA_CM_EVENT_ESTABLISHED: case RDMA_CM_EVENT_ESTABLISHED:
......
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