qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 6/7] scsi-disk: improve out-of-range LBA detection f


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 6/7] scsi-disk: improve out-of-range LBA detection for WRITE SAME
Date: Thu, 9 Aug 2012 15:38:30 +0200

Signed-off-by: Paolo Bonzini <address@hidden>
---
 hw/scsi-disk.c | 3 ++-
 1 file modificato, 2 inserzioni(+). 1 rimozione(-)

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 3baa238..dd7ae6d 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1712,7 +1712,8 @@ static int32_t scsi_disk_emulate_command(SCSIRequest 
*req, uint8_t *buf)
             scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED));
             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;
         }
 
-- 
1.7.11.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]