Message ID | 20210827092643.273357-1-starmiku1207184332@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | scsi: qla4xxx: Fix a buffer overflow in qla4xxx_free_ddb() | expand |
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index f786ac2f5548..e5b2161e59ed 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c @@ -47,6 +47,8 @@ static void ql4xxx_set_mac_number(struct scsi_qla_host *ha) void qla4xxx_free_ddb(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry) { + if (ddb_entry->fw_ddb_index >= MAX_DDB_ENTRIES) + return; /* Remove device pointer from index mapping arrays */ ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = (struct ddb_entry *) INVALID_ENTRY;