Blob Blame History Raw
From: Lijun Ou <oulijun@huawei.com>
Date: Wed, 25 Jul 2018 15:29:37 +0800
Subject: RDMA/hns: Add illegal hop_num judgement
Patch-mainline: v4.19-rc1
Git-commit: 26f63b9c33ceda12fb9136a1d0c80e03c9ebb514
References: bsc#1104427 FATE#326416

When hop_num is more than three, it need to return -EINVAL.  This patch
fixes it.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/infiniband/hw/hns/hns_roce_hem.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/infiniband/hw/hns/hns_roce_hem.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hem.c
@@ -494,6 +494,9 @@ static int hns_roce_table_mhop_get(struc
 			step_idx = 1;
 		} else if (hop_num == HNS_ROCE_HOP_NUM_0) {
 			step_idx = 0;
+		} else {
+			ret = -EINVAL;
+			goto err_dma_alloc_l1;
 		}
 
 		/* set HEM base address to hardware */