[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] scsi-generic: check the return value of bdr
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] scsi-generic: check the return value of bdrv_aio_ioctl in execute_command |
Date: |
Wed, 29 May 2013 14:22:33 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
Il 29/05/2013 14:12, Pavel Hrdina ha scritto:
> 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.
>
> Signed-off-by: Pavel Hrdina <address@hidden>
> ---
> hw/scsi/scsi-generic.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
> index 2a9a561..8a4dae2 100644
> --- a/hw/scsi/scsi-generic.c
> +++ b/hw/scsi/scsi-generic.c
> @@ -174,6 +174,10 @@ 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) {
> + BADF("execute_command: read failed !\n");
> + return -EIO;
> + }
>
> return 0;
> }
>
Applied to scsi branch with the BADF removed. Thanks.
Paolo