]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[IB] mthca: check P_Key index in modify QP
authorJack Morgenstein <jackm@mellanox.co.il>
Thu, 3 Nov 2005 22:58:33 +0000 (14:58 -0800)
committerRoland Dreier <rolandd@cisco.com>
Thu, 3 Nov 2005 22:58:33 +0000 (14:58 -0800)
Make sure that the P_Key index passed into mthca_modify_qp() is
within the device's P_Key table.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mthca/mthca_qp.c

index 62ff091505da73e43dc074319f5e58c14d89dfe4..8b0b93565a256c7aa07bcb29294386a9a9c8a64a 100644 (file)
@@ -582,6 +582,13 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
                return -EINVAL;
        }
 
+       if ((attr_mask & IB_QP_PKEY_INDEX) && 
+            attr->pkey_index >= dev->limits.pkey_table_len) {
+               mthca_dbg(dev, "PKey index (%u) too large. max is %d\n",
+                         attr->pkey_index,dev->limits.pkey_table_len-1); 
+               return -EINVAL;
+       }
+
        mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
        if (IS_ERR(mailbox))
                return PTR_ERR(mailbox);