Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1479831

[PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl

From Salil Mehta <salil.mehta@huawei.com>
Newsgroups linux.kernel
Subject [PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl
Date 2016-09-09 12:20 +0200
Message-ID <sfr4B-1xy-9@gated-at.bofh.it> (permalink)
References <sfr4B-1xy-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Lijun Ou <oulijun@huawei.com>

The pointer ctrl may be null, so we add check for it.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Reviewed-by: Wei Hu <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 5f76fc1..ea47ec4 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -336,6 +336,12 @@ int hns_roce_v1_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
 		}
 
 		ctrl = get_recv_wqe(hr_qp, ind);
+		if (unlikely(!ctrl)) {
+			dev_err(dev, "Get recv wqe failed!\n");
+			ret = -EINVAL;
+			*bad_wr = wr;
+			goto out;
+		}
 
 		roce_set_field(ctrl->rwqe_byte_12,
 			       RQ_WQE_CTRL_RWQE_BYTE_12_RWQE_SGE_NUM_M,
-- 
1.7.9.5

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl Salil Mehta <salil.mehta@huawei.com> - 2016-09-09 12:20 +0200
  Re: [PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl Leon Romanovsky <leon@kernel.org> - 2016-09-15 12:10 +0200
    RE: [PATCH for-next 03/20] IB/hns: Add the check for pointer ctrl Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 19:00 +0200

csiph-web