scsi-disk: improve out-of-range LBA detection for WRITE SAME
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
46e3f30e3c
commit
a084a703df
|
@ -1712,7 +1712,8 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
|
||||||
scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED));
|
scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (r->req.cmd.lba > s->qdev.max_lba) {
|
if (r->req.cmd.lba > r->req.cmd.lba + nb_sectors ||
|
||||||
|
r->req.cmd.lba + nb_sectors - 1 > s->qdev.max_lba) {
|
||||||
goto illegal_lba;
|
goto illegal_lba;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue