diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_mr.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_qp.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_verbs.c | 11 |
3 files changed, 24 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_mr.c b/drivers/infiniband/hw/ipath/ipath_mr.c index 30936769ab3a..4ac31a5da330 100644 --- a/drivers/infiniband/hw/ipath/ipath_mr.c +++ b/drivers/infiniband/hw/ipath/ipath_mr.c | |||
@@ -170,6 +170,11 @@ struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, struct ib_umem *region, | |||
170 | int n, m, i; | 170 | int n, m, i; |
171 | struct ib_mr *ret; | 171 | struct ib_mr *ret; |
172 | 172 | ||
173 | if (region->length == 0) { | ||
174 | ret = ERR_PTR(-EINVAL); | ||
175 | goto bail; | ||
176 | } | ||
177 | |||
173 | n = 0; | 178 | n = 0; |
174 | list_for_each_entry(chunk, ®ion->chunk_list, list) | 179 | list_for_each_entry(chunk, ®ion->chunk_list, list) |
175 | n += chunk->nents; | 180 | n += chunk->nents; |
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 47271be65b0f..e6fc4c02823f 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -667,6 +667,14 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
667 | goto bail; | 667 | goto bail; |
668 | } | 668 | } |
669 | 669 | ||
670 | if (init_attr->cap.max_send_sge + | ||
671 | init_attr->cap.max_recv_sge + | ||
672 | init_attr->cap.max_send_wr + | ||
673 | init_attr->cap.max_recv_wr == 0) { | ||
674 | ret = ERR_PTR(-EINVAL); | ||
675 | goto bail; | ||
676 | } | ||
677 | |||
670 | switch (init_attr->qp_type) { | 678 | switch (init_attr->qp_type) { |
671 | case IB_QPT_UC: | 679 | case IB_QPT_UC: |
672 | case IB_QPT_RC: | 680 | case IB_QPT_RC: |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 6af5402fe447..18375e831744 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -792,6 +792,17 @@ static struct ib_ah *ipath_create_ah(struct ib_pd *pd, | |||
792 | goto bail; | 792 | goto bail; |
793 | } | 793 | } |
794 | 794 | ||
795 | if (ah_attr->dlid == 0) { | ||
796 | ret = ERR_PTR(-EINVAL); | ||
797 | goto bail; | ||
798 | } | ||
799 | |||
800 | if (ah_attr->port_num != 1 || | ||
801 | ah_attr->port_num > pd->device->phys_port_cnt) { | ||
802 | ret = ERR_PTR(-EINVAL); | ||
803 | goto bail; | ||
804 | } | ||
805 | |||
795 | ah = kmalloc(sizeof *ah, GFP_ATOMIC); | 806 | ah = kmalloc(sizeof *ah, GFP_ATOMIC); |
796 | if (!ah) { | 807 | if (!ah) { |
797 | ret = ERR_PTR(-ENOMEM); | 808 | ret = ERR_PTR(-ENOMEM); |