From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtlJY-0001Ug-57 for qemu-devel@nongnu.org; Thu, 19 Dec 2013 16:39:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtlJO-0005gZ-GL for qemu-devel@nongnu.org; Thu, 19 Dec 2013 16:39:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:31815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtlJO-0005gQ-8p for qemu-devel@nongnu.org; Thu, 19 Dec 2013 16:39:18 -0500 Date: Thu, 19 Dec 2013 12:25:59 -0500 From: Jeff Cody Message-ID: <20131219172559.GF4699@localhost.localdomain> References: <1385447913-19004-1-git-send-email-gesaint@linux.vnet.ibm.com> <1385447913-19004-5-git-send-email-gesaint@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1385447913-19004-5-git-send-email-gesaint@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH V9 4/4] blockdev: Add infinite loop check in drive_init() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xu Wang Cc: kwolf@redhat.com, stefanha@gmail.com, famz@redhat.com, qemu-devel@nongnu.org, wdongxu@linux.vnet.ibm.com On Tue, Nov 26, 2013 at 01:38:33AM -0500, Xu Wang wrote: > Check the backing file for a loop during image boot, to avoid a lack or > response or segfault. > > Signed-off-by: Xu Wang > --- > blockdev.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/blockdev.c b/blockdev.c > index 330aa4a..e39fc27 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -511,6 +511,13 @@ static DriveInfo *blockdev_init(QDict *bs_opts, > > bdrv_flags |= ro ? 0 : BDRV_O_RDWR; > > + /* Add backing file loop check */ > + if (!bdrv_backing_chain_okay(file, drv, NULL, &error)) { > + error_setg(errp, "drive_init: backing file loop check failed. %s", > + error_get_pretty(error)); Leaks error. > + goto err; > + } > + > QINCREF(bs_opts); > ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error); > > -- > 1.8.1.4 > >