lkml.org 
[lkml]   [2021]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] scsi: be2iscsi:Fix the problem that the array may be out of bounds
Date
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@kylinos.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
\
 
 \ /
  Last update: 2021-11-22 05:31    [W:0.069 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site