From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNeor-0002V5-DV for qemu-devel@nongnu.org; Tue, 17 Feb 2015 04:51:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNeoo-0002Of-72 for qemu-devel@nongnu.org; Tue, 17 Feb 2015 04:51:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNeon-0002OW-W8 for qemu-devel@nongnu.org; Tue, 17 Feb 2015 04:51:50 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1H9pmoU027155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 17 Feb 2015 04:51:48 -0500 Date: Tue, 17 Feb 2015 17:51:45 +0800 From: Fam Zheng Message-ID: <20150217095145.GA7432@fam-t430.nay.redhat.com> References: <1424143757-557-1-git-send-email-famz@redhat.com> <20150217093420.GB4213@noname.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150217093420.GB4213@noname.str.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: Kevin Wolf Cc: Paolo Bonzini , qemu-devel@nongnu.org, Stefan Hajnoczi On Tue, 02/17 10:34, Kevin Wolf wrote: > 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. > Yes, will fix in v2. Thanks, Fam