diff options
| -rw-r--r-- | drivers/infiniband/core/cma.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 84487a2e651a..431465563364 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
| @@ -2676,29 +2676,32 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | |||
| 2676 | { | 2676 | { |
| 2677 | struct ib_cm_sidr_req_param req; | 2677 | struct ib_cm_sidr_req_param req; |
| 2678 | struct ib_cm_id *id; | 2678 | struct ib_cm_id *id; |
| 2679 | void *private_data; | ||
| 2679 | int offset, ret; | 2680 | int offset, ret; |
| 2680 | 2681 | ||
| 2682 | memset(&req, 0, sizeof req); | ||
| 2681 | offset = cma_user_data_offset(id_priv); | 2683 | offset = cma_user_data_offset(id_priv); |
| 2682 | req.private_data_len = offset + conn_param->private_data_len; | 2684 | req.private_data_len = offset + conn_param->private_data_len; |
| 2683 | if (req.private_data_len < conn_param->private_data_len) | 2685 | if (req.private_data_len < conn_param->private_data_len) |
| 2684 | return -EINVAL; | 2686 | return -EINVAL; |
| 2685 | 2687 | ||
| 2686 | if (req.private_data_len) { | 2688 | if (req.private_data_len) { |
| 2687 | req.private_data = kzalloc(req.private_data_len, GFP_ATOMIC); | 2689 | private_data = kzalloc(req.private_data_len, GFP_ATOMIC); |
| 2688 | if (!req.private_data) | 2690 | if (!private_data) |
| 2689 | return -ENOMEM; | 2691 | return -ENOMEM; |
| 2690 | } else { | 2692 | } else { |
| 2691 | req.private_data = NULL; | 2693 | private_data = NULL; |
| 2692 | } | 2694 | } |
| 2693 | 2695 | ||
| 2694 | if (conn_param->private_data && conn_param->private_data_len) | 2696 | if (conn_param->private_data && conn_param->private_data_len) |
| 2695 | memcpy((void *) req.private_data + offset, | 2697 | memcpy(private_data + offset, conn_param->private_data, |
| 2696 | conn_param->private_data, conn_param->private_data_len); | 2698 | conn_param->private_data_len); |
| 2697 | 2699 | ||
| 2698 | if (req.private_data) { | 2700 | if (private_data) { |
| 2699 | ret = cma_format_hdr((void *) req.private_data, id_priv); | 2701 | ret = cma_format_hdr(private_data, id_priv); |
| 2700 | if (ret) | 2702 | if (ret) |
| 2701 | goto out; | 2703 | goto out; |
| 2704 | req.private_data = private_data; | ||
| 2702 | } | 2705 | } |
| 2703 | 2706 | ||
| 2704 | id = ib_create_cm_id(id_priv->id.device, cma_sidr_rep_handler, | 2707 | id = ib_create_cm_id(id_priv->id.device, cma_sidr_rep_handler, |
| @@ -2720,7 +2723,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | |||
| 2720 | id_priv->cm_id.ib = NULL; | 2723 | id_priv->cm_id.ib = NULL; |
| 2721 | } | 2724 | } |
| 2722 | out: | 2725 | out: |
| 2723 | kfree(req.private_data); | 2726 | kfree(private_data); |
| 2724 | return ret; | 2727 | return ret; |
| 2725 | } | 2728 | } |
| 2726 | 2729 | ||
