diff options
author | Jan Beulich <JBeulich@suse.com> | 2016-11-25 03:05:57 -0700 |
---|---|---|
committer | Stefano Stabellini <sstabellini@kernel.org> | 2016-11-28 11:25:23 -0800 |
commit | ff3b8b8f864fa5721b196ca3dcc48853b0ee0275 (patch) | |
tree | cb46e54d698a9bf3e3bcc2f6f7240464be5c5c39 /xen-hvm.c | |
parent | 7875efb9f641ed0e79320bf258ee69cd0bf03716 (diff) |
xen: fix quad word bufioreq handling
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 <yanghongke@huawei.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Diffstat (limited to 'xen-hvm.c')
-rw-r--r-- | xen-hvm.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |