mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [git patch review 1/7] IB/mthca: check RDMA limits
@ 2005-12-16  4:00 Roland Dreier
  2005-12-16  4:00 ` [git patch review 2/7] IB/mthca: correct log2 calculation Roland Dreier
  0 siblings, 1 reply; 9+ messages in thread
From: Roland Dreier @ 2005-12-16  4:00 UTC (permalink / raw)
  To: linux-kernel, openib-general

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>

---

 drivers/infiniband/hw/mthca/mthca_qp.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

94361cf74a6fca1973d2fed5338d5fb4bcd902fa
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 7450550..c5c3d0e 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, 
 		return -EINVAL;
 	}
 
+	if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC &&
+	    attr->max_rd_atomic > dev->limits.max_qp_init_rdma) {
+		mthca_dbg(dev, "Max rdma_atomic as initiator %u too large (max is %d)\n",
+			  attr->max_rd_atomic, dev->limits.max_qp_init_rdma);
+		return -EINVAL;
+	}
+
+	if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC &&
+	    attr->max_dest_rd_atomic > 1 << dev->qp_table.rdb_shift) {
+		mthca_dbg(dev, "Max rdma_atomic as responder %u too large (max %d)\n",
+			  attr->max_dest_rd_atomic, 1 << dev->qp_table.rdb_shift);
+		return -EINVAL;
+	}
+
 	mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
 	if (IS_ERR(mailbox))
 		return PTR_ERR(mailbox);
-- 
0.99.9n

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-17 21:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-16  4:00 [git patch review 1/7] IB/mthca: check RDMA limits Roland Dreier
2005-12-16  4:00 ` [git patch review 2/7] IB/mthca: correct log2 calculation Roland Dreier
2005-12-16  4:00   ` [git patch review 3/7] IB/mthca: don't change driver's copy of attributes if modify QP fails Roland Dreier
2005-12-16  4:00     ` [git patch review 4/7] IB/mthca: Fix thinko in mthca_table_find() Roland Dreier
2005-12-16  4:00       ` [git patch review 5/7] IB/mthca: Fix SRQ cleanup during QP destroy Roland Dreier
2005-12-16  4:00         ` [git patch review 6/7] IB/mthca: Fix IB_QP_ACCESS_FLAGS handling Roland Dreier
2005-12-16  4:00           ` [git patch review 7/7] IB/mthca: Fix corner cases in max_rd_atomic value handling in modify QP Roland Dreier
2005-12-17 20:38   ` [git patch review 2/7] IB/mthca: correct log2 calculation Andrew Morton
2005-12-17 21:30     ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®