From: Roland Dreier Date: Mon, 21 May 2007 03:19:24 +0000 (-0700) Subject: IB/mlx4: Check if SRQ is full when posting receive X-Git-Tag: v2.6.22-rc3~108^2~3 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=56a8c8b6ac4d6edba5153d17730aaf96ba8f1f8c;p=linux-2.6-omap-h63xx.git IB/mlx4: Check if SRQ is full when posting receive Make mlx4_post_srq_recv() fail if the SRQ is full (head == tail). Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c index 42ab4a801d6..12fac1c8989 100644 --- a/drivers/infiniband/hw/mlx4/srq.c +++ b/drivers/infiniband/hw/mlx4/srq.c @@ -297,6 +297,12 @@ int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, break; } + if (unlikely(srq->head == srq->tail)) { + err = -ENOMEM; + *bad_wr = wr; + break; + } + srq->wrid[srq->head] = wr->wr_id; next = get_wqe(srq, srq->head);