diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/cma.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 75ff821c0af0..d0d4aa9f4802 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -2513,6 +2513,9 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | |||
2513 | 2513 | ||
2514 | req.private_data_len = sizeof(struct cma_hdr) + | 2514 | req.private_data_len = sizeof(struct cma_hdr) + |
2515 | conn_param->private_data_len; | 2515 | conn_param->private_data_len; |
2516 | if (req.private_data_len < conn_param->private_data_len) | ||
2517 | return -EINVAL; | ||
2518 | |||
2516 | req.private_data = kzalloc(req.private_data_len, GFP_ATOMIC); | 2519 | req.private_data = kzalloc(req.private_data_len, GFP_ATOMIC); |
2517 | if (!req.private_data) | 2520 | if (!req.private_data) |
2518 | return -ENOMEM; | 2521 | return -ENOMEM; |
@@ -2562,6 +2565,9 @@ static int cma_connect_ib(struct rdma_id_private *id_priv, | |||
2562 | memset(&req, 0, sizeof req); | 2565 | memset(&req, 0, sizeof req); |
2563 | offset = cma_user_data_offset(id_priv->id.ps); | 2566 | offset = cma_user_data_offset(id_priv->id.ps); |
2564 | req.private_data_len = offset + conn_param->private_data_len; | 2567 | req.private_data_len = offset + conn_param->private_data_len; |
2568 | if (req.private_data_len < conn_param->private_data_len) | ||
2569 | return -EINVAL; | ||
2570 | |||
2565 | private_data = kzalloc(req.private_data_len, GFP_ATOMIC); | 2571 | private_data = kzalloc(req.private_data_len, GFP_ATOMIC); |
2566 | if (!private_data) | 2572 | if (!private_data) |
2567 | return -ENOMEM; | 2573 | return -ENOMEM; |