diff --git a/devices/common/scsi/scsicdrom.cpp b/devices/common/scsi/scsicdrom.cpp index f0dc905..8c20cd9 100644 --- a/devices/common/scsi/scsicdrom.cpp +++ b/devices/common/scsi/scsicdrom.cpp @@ -178,6 +178,9 @@ bool ScsiCdrom::get_more_data() { void ScsiCdrom::read(uint32_t lba, uint16_t nblocks, uint8_t cmd_len) { + if (!check_lun()) + return; + if (cmd_len == 6 && nblocks == 0) nblocks = 256; @@ -381,6 +384,9 @@ void ScsiCdrom::read_capacity_10() return; } + if (!check_lun()) + return; + int last_lba = (int)this->size_blocks - 1; WRITE_DWORD_BE_A(&this->data_buf[0], last_lba); diff --git a/devices/common/scsi/scsihd.cpp b/devices/common/scsi/scsihd.cpp index 830a1ae..9a3d06d 100644 --- a/devices/common/scsi/scsihd.cpp +++ b/devices/common/scsi/scsihd.cpp @@ -323,6 +323,9 @@ void ScsiHardDisk::read_capacity_10() { return; } + if (!check_lun()) + return; + uint32_t last_lba = this->total_blocks - 1; uint32_t blk_len = this->sector_size; @@ -346,6 +349,9 @@ void ScsiHardDisk::format() { } void ScsiHardDisk::read(uint32_t lba, uint16_t transfer_len, uint8_t cmd_len) { + if (!check_lun()) + return; + uint32_t transfer_size = transfer_len; std::memset(this->data_buf, 0, sizeof(this->data_buf));