Skip to content

Commit

Permalink
IB/ipath: do not allow use of CQ entries with invalid counts
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Bryan O'Sullivan authored and Roland Dreier committed Sep 22, 2006
1 parent 98341f2 commit eae33d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/infiniband/hw/ipath/ipath_cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries,
struct ipath_cq_wc *wc;
struct ib_cq *ret;

if (entries > ib_ipath_max_cqes) {
if (entries < 1 || entries > ib_ipath_max_cqes) {
ret = ERR_PTR(-EINVAL);
goto done;
}
Expand Down Expand Up @@ -324,6 +324,11 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
u32 head, tail, n;
int ret;

if (cqe < 1 || cqe > ib_ipath_max_cqes) {
ret = -EINVAL;
goto bail;
}

/*
* Need to use vmalloc() if we want to support large #s of entries.
*/
Expand Down

0 comments on commit eae33d4

Please sign in to comment.