提交 eae33d47 编写于 作者: B Bryan O'Sullivan 提交者: Roland Dreier

IB/ipath: do not allow use of CQ entries with invalid counts

Signed-off-by: NBryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 98341f26
...@@ -172,7 +172,7 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, ...@@ -172,7 +172,7 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries,
struct ipath_cq_wc *wc; struct ipath_cq_wc *wc;
struct ib_cq *ret; struct ib_cq *ret;
if (entries > ib_ipath_max_cqes) { if (entries < 1 || entries > ib_ipath_max_cqes) {
ret = ERR_PTR(-EINVAL); ret = ERR_PTR(-EINVAL);
goto done; goto done;
} }
...@@ -324,6 +324,11 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) ...@@ -324,6 +324,11 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
u32 head, tail, n; u32 head, tail, n;
int ret; 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. * Need to use vmalloc() if we want to support large #s of entries.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册