From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNeXz-00059u-T6 for qemu-devel@nongnu.org; Tue, 17 Feb 2015 04:34:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNeXv-0003YA-RD for qemu-devel@nongnu.org; Tue, 17 Feb 2015 04:34:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNeXv-0003Y5-JA for qemu-devel@nongnu.org; Tue, 17 Feb 2015 04:34:23 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1H9YM0v031731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 17 Feb 2015 04:34:22 -0500 Date: Tue, 17 Feb 2015 10:34:20 +0100 From: Kevin Wolf Message-ID: <20150217093420.GB4213@noname.str.redhat.com> References: <1424143757-557-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1424143757-557-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH] virtio-blk: Check return value of blk_aio_ioctl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Paolo Bonzini , qemu-devel@nongnu.org, Stefan Hajnoczi Am 17.02.2015 um 04:29 hat Fam Zheng geschrieben: > Since commit 1dc936aa84 (virtio-blk: Use blk_aio_ioctl) we silently lose > the request if blk_aio_ioctl returns NULL (not implemented). > > Fix it by directly returning VIRTIO_BLK_S_UNSUPP as we used to do. > > Signed-off-by: Fam Zheng > --- > hw/block/virtio-blk.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index 1a8a176..c7c8f20 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -197,6 +197,7 @@ static int virtio_blk_handle_scsi_req(VirtIOBlockReq *req) > VirtIODevice *vdev = VIRTIO_DEVICE(req->dev); > VirtQueueElement *elem = &req->elem; > VirtIOBlock *blk = req->dev; > + BlockAIOCB *acb; > > #ifdef __linux__ > int i; > @@ -278,8 +279,12 @@ static int virtio_blk_handle_scsi_req(VirtIOBlockReq *req) > ioctl_req->hdr.sbp = elem->in_sg[elem->in_num - 3].iov_base; > ioctl_req->hdr.mx_sb_len = elem->in_sg[elem->in_num - 3].iov_len; > > - blk_aio_ioctl(blk->blk, SG_IO, &ioctl_req->hdr, > - virtio_blk_ioctl_complete, ioctl_req); > + acb = blk_aio_ioctl(blk->blk, SG_IO, &ioctl_req->hdr, > + virtio_blk_ioctl_complete, ioctl_req); > + if (!acb) { > + status = VIRTIO_BLK_S_UNSUPP; > + goto fail; > + } > return -EINPROGRESS; > #else > abort(); This leaks ioctl_req. Kevin