scsi-generic: check the return value of bdrv_aio_ioctl in execute_command

This fixes the bug introduced by this commit ad54ae80c7.
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>
This commit is contained in:
Pavel Hrdina 2013-05-29 14:12:10 +02:00 committed by Paolo Bonzini
parent 53254e569f
commit d836f8d35d
1 changed files with 3 additions and 0 deletions

View File

@ -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;
}