diff options
author | Tatyana Nikolova <Tatyana.E.Nikolova@intel.com> | 2012-08-03 19:59:41 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-08-13 16:08:35 -0400 |
commit | 418edaaba96e58112b15c82b4907084e2a9caf42 (patch) | |
tree | 1472ed448d5ec116731480526b4bea2c1e0dfa91 /drivers/infiniband/core | |
parent | 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff) |
RDMA/ucma.c: Fix for events with wrong context on iWARP
It is possible for asynchronous RDMA_CM_EVENT_ESTABLISHED events to be
generated with ctx->uid == 0, because ucma_set_event_context() copies
ctx->uid to the event structure outside of ctx->file->mut. This leads
to a crash in the userspace library, since it gets a bogus event.
Fix this by taking the mutex a bit earlier in ucma_event_handler.
Signed-off-by: Tatyana Nikolova <Tatyana.E.Nikolova@intel.com>
Signed-off-by: Sean Hefty <Sean.Hefty@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/ucma.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 6bf850422895..055ed59838dc 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -267,6 +267,7 @@ static int ucma_event_handler(struct rdma_cm_id *cm_id, | |||
267 | if (!uevent) | 267 | if (!uevent) |
268 | return event->event == RDMA_CM_EVENT_CONNECT_REQUEST; | 268 | return event->event == RDMA_CM_EVENT_CONNECT_REQUEST; |
269 | 269 | ||
270 | mutex_lock(&ctx->file->mut); | ||
270 | uevent->cm_id = cm_id; | 271 | uevent->cm_id = cm_id; |
271 | ucma_set_event_context(ctx, event, uevent); | 272 | ucma_set_event_context(ctx, event, uevent); |
272 | uevent->resp.event = event->event; | 273 | uevent->resp.event = event->event; |
@@ -277,7 +278,6 @@ static int ucma_event_handler(struct rdma_cm_id *cm_id, | |||
277 | ucma_copy_conn_event(&uevent->resp.param.conn, | 278 | ucma_copy_conn_event(&uevent->resp.param.conn, |
278 | &event->param.conn); | 279 | &event->param.conn); |
279 | 280 | ||
280 | mutex_lock(&ctx->file->mut); | ||
281 | if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) { | 281 | if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) { |
282 | if (!ctx->backlog) { | 282 | if (!ctx->backlog) { |
283 | ret = -ENOMEM; | 283 | ret = -ENOMEM; |