diff options
author | Jack Morgenstein <jackm@mellanox.co.il> | 2005-11-03 14:58:33 -0800 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-11-03 14:58:33 -0800 |
commit | d09e32764176b61c4afee9fd5e7fe04713bfa56f (patch) | |
tree | 1818a0043dcbc9789dbc12c6affe5a6924d65366 /drivers/infiniband | |
parent | 0c99cb6d5fe77872c5a32cff837c05f70158ce15 (diff) | |
download | kernel-crypto-d09e32764176b61c4afee9fd5e7fe04713bfa56f.tar.gz kernel-crypto-d09e32764176b61c4afee9fd5e7fe04713bfa56f.tar.xz kernel-crypto-d09e32764176b61c4afee9fd5e7fe04713bfa56f.zip |
[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/infiniband')
-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 62ff091505d..8b0b93565a2 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) 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); |