[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211120003233.69789-1-wenzhiwei@kylinos.cn>
Date: Sat, 20 Nov 2021 08:32:33 +0800
From: Wen Zhiwei <wenzhiwei@...inos.cn>
To: subbu.seetharaman@...adcom.com, ketan.mukadam@...adcom.com,
jitendra.bhivare@...adcom.com, jejb@...ux.ibm.com,
martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: be2iscsi:Fix the problem that the array may be out of bounds
By observing that the value of ulp_num may be
'BEISCSI_ULP_COUNT',this will cause the problem
of data out of bounds.Increase judgments to
eliminate risks.
Signed-off-by: Wen Zhiwei <wenzhiwei@...inos.cn>
---
drivers/scsi/be2iscsi/be_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index ab55681145f8..392a53184a00 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3947,7 +3947,8 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++)
if (test_bit(ulp_num, &phba->fw_config.ulp_supported))
break;
-
+ if (ulp_num >= BEISCSI_ULP_COUNT)
+ return -ENOMEM;
ulp_icd_start = phba->fw_config.iscsi_icd_start[ulp_num];
arr_index = 0;
--
2.30.0
Powered by blists - more mailing lists