diff options
author | Jack Morgenstein <jackm@mellanox.co.il> | 2005-12-09 19:32:21 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-12-09 19:32:21 -0500 |
commit | 94361cf74a6fca1973d2fed5338d5fb4bcd902fa (patch) | |
tree | 5b96f7c52f1d1e60d3406a41393922d77abf67b3 /drivers/infiniband/hw/mthca | |
parent | 52d0df153c987e4ad57d15f5df91848f65858e5d (diff) |
IB/mthca: check RDMA limits
Add limit checking on rd_atomic and dest_rd_atomic attributes:
especially for max_dest_rd_atomic, a value that is larger than HCA
capability can cause RDB overflow and corruption of another QP.
Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 7450550db736..c5c3d0edbbf5 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -591,6 +591,20 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
591 | return -EINVAL; | 591 | return -EINVAL; |
592 | } | 592 | } |
593 | 593 | ||
594 | if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && | ||
595 | attr->max_rd_atomic > dev->limits.max_qp_init_rdma) { | ||
596 | mthca_dbg(dev, "Max rdma_atomic as initiator %u too large (max is %d)\n", | ||
597 | attr->max_rd_atomic, dev->limits.max_qp_init_rdma); | ||
598 | return -EINVAL; | ||
599 | } | ||
600 | |||
601 | if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && | ||
602 | attr->max_dest_rd_atomic > 1 << dev->qp_table.rdb_shift) { | ||
603 | mthca_dbg(dev, "Max rdma_atomic as responder %u too large (max %d)\n", | ||
604 | attr->max_dest_rd_atomic, 1 << dev->qp_table.rdb_shift); | ||
605 | return -EINVAL; | ||
606 | } | ||
607 | |||
594 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); | 608 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); |
595 | if (IS_ERR(mailbox)) | 609 | if (IS_ERR(mailbox)) |
596 | return PTR_ERR(mailbox); | 610 | return PTR_ERR(mailbox); |