From ea5eabfe6c17a4699dddfd0dbfea60f947b0d030 Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Wed, 14 Aug 2013 20:03:17 -0700 Subject: [PATCH] RDS: Reconnect causes panic at completion phase The connection can be shutdown while it is processing the RDMA_CM_EVENT_ESTABLISHED event, and this can lead to panic if the cm_id has been destroyed. The fix was to drop the connection if the cm_id has been destroyed. Orabug: 17213597 Signed-off-by: Richard Frank (cherry picked from commit 000fdbea7eab93fc55c45de7302b6560fd41b7f1) --- net/rds/ib_cm.c | 6 ++++++ net/rds/rdma_transport.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c index 2982161177f4..11e2a5f831fa 100644 --- a/net/rds/ib_cm.c +++ b/net/rds/ib_cm.c @@ -170,6 +170,12 @@ void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_even RDS_PROTOCOL_MINOR(conn->c_version), ic->i_flowctl ? ", flow control" : ""); + /* The connection might have been dropped under us*/ + if (!ic->i_cm_id) { + rds_conn_drop(conn); + return; + } + ic->i_sl = ic->i_cm_id->route.path_rec->sl; /* diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c index 407e13166deb..812d1da86d7d 100644 --- a/net/rds/rdma_transport.c +++ b/net/rds/rdma_transport.c @@ -113,9 +113,9 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id, if (ibic && ibic->i_cm_id == cm_id) ibic->i_cm_id = NULL; rds_conn_drop(conn); - } else if (conn->c_to_index < (RDS_RDMA_RESOLVE_TO_MAX_INDEX-1)) + } + } else if (conn->c_to_index < (RDS_RDMA_RESOLVE_TO_MAX_INDEX-1)) conn->c_to_index++; - } break; case RDMA_CM_EVENT_ROUTE_RESOLVED: -- 2.50.1