diff options
Diffstat (limited to 'drivers/infiniband/core/ucma.c')
-rw-r--r-- | drivers/infiniband/core/ucma.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 82fb1e6e1384..22ed97ef7da3 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -531,6 +531,30 @@ static ssize_t ucma_bind_ip(struct ucma_file *file, const char __user *inbuf, | |||
531 | return ret; | 531 | return ret; |
532 | } | 532 | } |
533 | 533 | ||
534 | static ssize_t ucma_bind(struct ucma_file *file, const char __user *inbuf, | ||
535 | int in_len, int out_len) | ||
536 | { | ||
537 | struct rdma_ucm_bind cmd; | ||
538 | struct sockaddr *addr; | ||
539 | struct ucma_context *ctx; | ||
540 | int ret; | ||
541 | |||
542 | if (copy_from_user(&cmd, inbuf, sizeof(cmd))) | ||
543 | return -EFAULT; | ||
544 | |||
545 | addr = (struct sockaddr *) &cmd.addr; | ||
546 | if (cmd.reserved || !cmd.addr_size || (cmd.addr_size != rdma_addr_size(addr))) | ||
547 | return -EINVAL; | ||
548 | |||
549 | ctx = ucma_get_ctx(file, cmd.id); | ||
550 | if (IS_ERR(ctx)) | ||
551 | return PTR_ERR(ctx); | ||
552 | |||
553 | ret = rdma_bind_addr(ctx->cm_id, addr); | ||
554 | ucma_put_ctx(ctx); | ||
555 | return ret; | ||
556 | } | ||
557 | |||
534 | static ssize_t ucma_resolve_ip(struct ucma_file *file, | 558 | static ssize_t ucma_resolve_ip(struct ucma_file *file, |
535 | const char __user *inbuf, | 559 | const char __user *inbuf, |
536 | int in_len, int out_len) | 560 | int in_len, int out_len) |
@@ -1398,7 +1422,8 @@ static ssize_t (*ucma_cmd_table[])(struct ucma_file *file, | |||
1398 | [RDMA_USER_CM_CMD_JOIN_IP_MCAST] = ucma_join_ip_multicast, | 1422 | [RDMA_USER_CM_CMD_JOIN_IP_MCAST] = ucma_join_ip_multicast, |
1399 | [RDMA_USER_CM_CMD_LEAVE_MCAST] = ucma_leave_multicast, | 1423 | [RDMA_USER_CM_CMD_LEAVE_MCAST] = ucma_leave_multicast, |
1400 | [RDMA_USER_CM_CMD_MIGRATE_ID] = ucma_migrate_id, | 1424 | [RDMA_USER_CM_CMD_MIGRATE_ID] = ucma_migrate_id, |
1401 | [RDMA_USER_CM_CMD_QUERY] = ucma_query | 1425 | [RDMA_USER_CM_CMD_QUERY] = ucma_query, |
1426 | [RDMA_USER_CM_CMD_BIND] = ucma_bind | ||
1402 | }; | 1427 | }; |
1403 | 1428 | ||
1404 | static ssize_t ucma_write(struct file *filp, const char __user *buf, | 1429 | static ssize_t ucma_write(struct file *filp, const char __user *buf, |