summaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorPavel Hrdina <phrdina@redhat.com>2013-05-29 14:12:10 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2013-06-18 12:43:03 +0200
commitd836f8d35dc418e24c3b11e2ea67d361b867b650 (patch)
tree8fe0ae5e03c3ffcf966e978fa1dc94332cccf5d0 /hw/scsi
parent53254e569f8e07501f3e0098bd57d2b780e52faa (diff)
downloadqemu-d836f8d35dc418e24c3b11e2ea67d361b867b650.tar.gz
scsi-generic: check the return value of bdrv_aio_ioctl in execute_command
This fixes the bug introduced by this commit ad54ae80c73f. The bdrv_aio_ioctl() still could return null and we should return an error in that case. Cc: qemu-stable@nongnu.org Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/scsi-generic.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 19bd36cd54..8f195bec00 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -174,6 +174,9 @@ static int execute_command(BlockDriverState *bdrv,
r->io_header.flags |= SG_FLAG_DIRECT_IO;
r->req.aiocb = bdrv_aio_ioctl(bdrv, SG_IO, &r->io_header, complete, r);
+ if (r->req.aiocb == NULL) {
+ return -EIO;
+ }
return 0;
}