]> err.no Git - linux-2.6/commitdiff
[PATCH] IB/ipath: don't allow resources to be created with illegal values
authorBryan O'Sullivan <bos@pathscale.com>
Sat, 1 Jul 2006 11:35:55 +0000 (04:35 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 1 Jul 2006 16:55:59 +0000 (09:55 -0700)
Signed-off-by: Robert Walsh <robert.walsh@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/infiniband/hw/ipath/ipath_mr.c
drivers/infiniband/hw/ipath/ipath_qp.c
drivers/infiniband/hw/ipath/ipath_verbs.c

index 30936769ab3a5da44ea788d79d579b2cc297e4e9..4ac31a5da3308dd5c77555d7e86fd69abce9b023 100644 (file)
@@ -170,6 +170,11 @@ struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
        int n, m, i;
        struct ib_mr *ret;
 
+       if (region->length == 0) {
+               ret = ERR_PTR(-EINVAL);
+               goto bail;
+       }
+
        n = 0;
        list_for_each_entry(chunk, &region->chunk_list, list)
                n += chunk->nents;
index 47271be65b0fbb8eae89f2db925d2be14dbba611..e6fc4c02823f406ca13e37e323cc262bdbadb4ec 100644 (file)
@@ -667,6 +667,14 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
                goto bail;
        }
 
+       if (init_attr->cap.max_send_sge +
+           init_attr->cap.max_recv_sge +
+           init_attr->cap.max_send_wr +
+           init_attr->cap.max_recv_wr == 0) {
+               ret = ERR_PTR(-EINVAL);
+               goto bail;
+       }
+
        switch (init_attr->qp_type) {
        case IB_QPT_UC:
        case IB_QPT_RC:
index 6af5402fe447616d44a21dcb036d0e604d944920..18375e8317442b2c0681bd67128eea6a73dcc62f 100644 (file)
@@ -792,6 +792,17 @@ static struct ib_ah *ipath_create_ah(struct ib_pd *pd,
                goto bail;
        }
 
+       if (ah_attr->dlid == 0) {
+               ret = ERR_PTR(-EINVAL);
+               goto bail;
+       }
+
+       if (ah_attr->port_num != 1 ||
+           ah_attr->port_num > pd->device->phys_port_cnt) {
+               ret = ERR_PTR(-EINVAL);
+               goto bail;
+       }
+
        ah = kmalloc(sizeof *ah, GFP_ATOMIC);
        if (!ah) {
                ret = ERR_PTR(-ENOMEM);