diff options
author | Jack Morgenstein <jackm@mellanox.co.il> | 2005-11-03 17:58:33 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-11-03 17:58:33 -0500 |
commit | d09e32764176b61c4afee9fd5e7fe04713bfa56f (patch) | |
tree | 1818a0043dcbc9789dbc12c6affe5a6924d65366 /drivers | |
parent | 0c99cb6d5fe77872c5a32cff837c05f70158ce15 (diff) |
[IB] mthca: check P_Key index in modify QP
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 62ff091505da..8b0b93565a25 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -582,6 +582,13 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
582 | return -EINVAL; | 582 | return -EINVAL; |
583 | } | 583 | } |
584 | 584 | ||
585 | if ((attr_mask & IB_QP_PKEY_INDEX) && | ||
586 | attr->pkey_index >= dev->limits.pkey_table_len) { | ||
587 | mthca_dbg(dev, "PKey index (%u) too large. max is %d\n", | ||
588 | attr->pkey_index,dev->limits.pkey_table_len-1); | ||
589 | return -EINVAL; | ||
590 | } | ||
591 | |||
585 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); | 592 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); |
586 | if (IS_ERR(mailbox)) | 593 | if (IS_ERR(mailbox)) |
587 | return PTR_ERR(mailbox); | 594 | return PTR_ERR(mailbox); |