IB/mthca: Check SRQ limit in modify SRQ operation
authorJack Morgenstein <jackm@mellanox.co.il>
Mon, 20 Mar 2006 15:32:43 +0000 (17:32 +0200)
committerRoland Dreier <rolandd@cisco.com>
Fri, 24 Mar 2006 23:47:28 +0000 (15:47 -0800)
When setting the shared receive queue (SRQ) watermark in a modify SRQ
operation, make sure that the supplied value is not larger than the
full size of the SRQ.

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

index 4e671e00e42b5fa25b8c6e9a57249be0f0b41953..0cfd158022179e23804b7c6b0d8a691e495c8d38 100644 (file)
@@ -358,6 +358,8 @@ int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
                return -EINVAL;
 
        if (attr_mask & IB_SRQ_LIMIT) {
+               if (attr->srq_limit > srq->max)
+                       return -EINVAL;
                ret = mthca_ARM_SRQ(dev, srq->srqn, attr->srq_limit, &status);
                if (ret)
                        return ret;