diff options
author | Sean Hefty <sean.hefty@intel.com> | 2007-05-07 14:49:12 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-05-14 16:56:32 -0400 |
commit | be65f086f2a50c478b2f5ecf4c55a52a4e95059a (patch) | |
tree | 11d048c93ea0f638a15ec47f4efda23731d202f1 | |
parent | 8aa08602bdd617a9cdd147f19076a8c8a70e03ef (diff) |
RDMA/cma: Fix synchronization with device removal in cma_iw_handler
The cma_iw_handler needs to validate the state of the rdma_cm_id before
processing a new connection request to ensure that a device removal is
not already being processed for the same rdma_cm_id. Without the state
check, the user can receive simultaneous callbacks for the same cm_id, or
a callback after they've destroyed the cm_id.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/core/cma.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index d026764c7e9c..cfd57b4abd03 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -1183,9 +1183,10 @@ static int cma_iw_handler(struct iw_cm_id *iw_id, struct iw_cm_event *iw_event) | |||
1183 | struct sockaddr_in *sin; | 1183 | struct sockaddr_in *sin; |
1184 | int ret = 0; | 1184 | int ret = 0; |
1185 | 1185 | ||
1186 | memset(&event, 0, sizeof event); | 1186 | if (cma_disable_remove(id_priv, CMA_CONNECT)) |
1187 | atomic_inc(&id_priv->dev_remove); | 1187 | return 0; |
1188 | 1188 | ||
1189 | memset(&event, 0, sizeof event); | ||
1189 | switch (iw_event->event) { | 1190 | switch (iw_event->event) { |
1190 | case IW_CM_EVENT_CLOSE: | 1191 | case IW_CM_EVENT_CLOSE: |
1191 | event.event = RDMA_CM_EVENT_DISCONNECTED; | 1192 | event.event = RDMA_CM_EVENT_DISCONNECTED; |