From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBRow-0005xH-IX for qemu-devel@nongnu.org; Mon, 28 Nov 2016 14:42:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBRou-0005WA-E9 for qemu-devel@nongnu.org; Mon, 28 Nov 2016 14:42:34 -0500 Received: from mail.kernel.org ([198.145.29.136]:50068) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cBRou-0005Vj-8I for qemu-devel@nongnu.org; Mon, 28 Nov 2016 14:42:32 -0500 From: Stefano Stabellini Date: Mon, 28 Nov 2016 11:42:24 -0800 Message-Id: <1480362146-14873-2-git-send-email-sstabellini@kernel.org> In-Reply-To: <1480362146-14873-1-git-send-email-sstabellini@kernel.org> References: <1480362146-14873-1-git-send-email-sstabellini@kernel.org> Subject: [Qemu-devel] [PULL 2/4] xen: fix quad word bufioreq handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stefanha@gmail.com Cc: stefanha@redhat.com, peter.maydell@linaro.org, sstabellini@kernel.org, anthony.perard@citrix.com, xen-devel@lists.xenproject.org, qemu-devel@nongnu.org, Jan Beulich , Jan Beulich From: Jan Beulich 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 Signed-off-by: Stefano Stabellini --- xen-hvm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen-hvm.c b/xen-hvm.c index 99b8ee8..d74e233 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -1021,6 +1021,9 @@ static int handle_buffered_iopage(XenIOState *state) 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; -- 1.9.1