From patchwork Fri Nov 25 10:05:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 699143 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tQBZB5FDKz9syB for ; Fri, 25 Nov 2016 21:06:58 +1100 (AEDT) Received: from localhost ([::1]:44996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cADPD-00061t-OY for incoming@patchwork.ozlabs.org; Fri, 25 Nov 2016 05:06:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cADOO-0005ec-Iu for qemu-devel@nongnu.org; Fri, 25 Nov 2016 05:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cADOJ-00070z-Hm for qemu-devel@nongnu.org; Fri, 25 Nov 2016 05:06:04 -0500 Received: from prv-mh.provo.novell.com ([137.65.248.74]:52502) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cADOJ-0006zy-7Q for qemu-devel@nongnu.org; Fri, 25 Nov 2016 05:05:59 -0500 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Fri, 25 Nov 2016 03:05:57 -0700 Message-Id: <58381B15020000780012226B@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Fri, 25 Nov 2016 03:05:57 -0700 From: "Jan Beulich" To: References: <583819ED020000780012225B@prv-mh.provo.novell.com> In-Reply-To: <583819ED020000780012225B@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 137.65.248.74 Subject: [Qemu-devel] [PATCH v2 1/3] xen: fix quad word bufioreq handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, xen-devel , Paul Durrant , Stefano Stabellini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We should not consume the second slot if it didn't get written yet. Normal writers - i.e. Xen - would not update write_pointer between the two writes, but the page may get fiddled with by the guest itself, and we're better off avoiding to enter an infinite loop in that case. Reported-by: yanghongke Signed-off-by: Jan Beulich Reviewed-by: Paul Durrant Reviewed-by: Stefano Stabellini --- v2: Bail (using hw_error()) instead of just breaking the loop. --- a/xen-hvm.c +++ b/xen-hvm.c @@ -1021,6 +1021,9 @@ static int handle_buffered_iopage(XenIOS xen_rmb(); qw = (req.size == 8); if (qw) { + if (rdptr + 1 == wrptr) { + hw_error("Incomplete quad word buffered ioreq"); + } buf_req = &buf_page->buf_ioreq[(rdptr + 1) % IOREQ_BUFFER_SLOT_NUM]; req.data |= ((uint64_t)buf_req->data) << 32;