From: Pavel Hrdina Date: Wed, 29 May 2013 12:12:10 +0000 (+0200) Subject: scsi-generic: check the return value of bdrv_aio_ioctl in execute_command X-Git-Tag: v1.5.1~7 X-Git-Url: https://git.proxmox.com/?p=qemu.git;a=commitdiff_plain;h=637d640fbbce498bd43a58b7a20b4190a1534751 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 Signed-off-by: Paolo Bonzini (cherry picked from commit d836f8d35dc418e24c3b11e2ea67d361b867b650) Signed-off-by: Michael Roth --- diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 19bd36cd5..8f195bec0 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; }