diff options
author | Sean Hefty <sean.hefty@intel.com> | 2006-06-18 07:37:28 +0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-06-18 07:37:28 +0400 |
commit | 6e61d04f2d8c7ac4f67e1f498ed2a2a3ad8edaa3 (patch) | |
tree | cf184fe1a9ebc7187cd452b2427234726436da94 /drivers/infiniband/core/ucm.c | |
parent | 6a9af2e18a5c6ebcf8283309d20ac0e9fa35e346 (diff) | |
download | linux-6e61d04f2d8c7ac4f67e1f498ed2a2a3ad8edaa3.tar.xz |
IB/cm: Match connection requests based on private data
Extend matching connection requests to listens in the InfiniBand CM to
include private data checks.
This allows applications to listen on the same service identifier,
with private data directing the request to the appropriate application.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/core/ucm.c')
-rw-r--r-- | drivers/infiniband/core/ucm.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index b396bf703f80..0136aee0faa7 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c @@ -648,6 +648,17 @@ out: return result; } +static int ucm_validate_listen(__be64 service_id, __be64 service_mask) +{ + service_id &= service_mask; + + if (((service_id & IB_CMA_SERVICE_ID_MASK) == IB_CMA_SERVICE_ID) || + ((service_id & IB_SDP_SERVICE_ID_MASK) == IB_SDP_SERVICE_ID)) + return -EINVAL; + + return 0; +} + static ssize_t ib_ucm_listen(struct ib_ucm_file *file, const char __user *inbuf, int in_len, int out_len) @@ -663,7 +674,13 @@ static ssize_t ib_ucm_listen(struct ib_ucm_file *file, if (IS_ERR(ctx)) return PTR_ERR(ctx); - result = ib_cm_listen(ctx->cm_id, cmd.service_id, cmd.service_mask); + result = ucm_validate_listen(cmd.service_id, cmd.service_mask); + if (result) + goto out; + + result = ib_cm_listen(ctx->cm_id, cmd.service_id, cmd.service_mask, + NULL); +out: ib_ucm_ctx_put(ctx); return result; } |