From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhfOz-0002qf-A3 for qemu-devel@nongnu.org; Wed, 29 May 2013 08:22:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhfOx-0001Bx-5J for qemu-devel@nongnu.org; Wed, 29 May 2013 08:22:49 -0400 Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:63826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhfOx-0001AW-18 for qemu-devel@nongnu.org; Wed, 29 May 2013 08:22:47 -0400 Received: by mail-qa0-f43.google.com with SMTP id j11so2145339qag.16 for ; Wed, 29 May 2013 05:22:46 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51A5F309.7040103@redhat.com> Date: Wed, 29 May 2013 14:22:33 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] scsi-generic: check the return value of bdrv_aio_ioctl in execute_command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: kwolf@redhat.com, qemu-devel@nongnu.org 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 > --- > 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