[PATCH] scsi: be2iscsi:Fix the problem that the array may be out of bounds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux