xen/evtchn: fix ring resize when binding new events
authorJan Beulich <JBeulich@suse.com>
Wed, 4 May 2016 13:02:36 +0000 (07:02 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 May 2016 09:21:15 +0000 (11:21 +0200)
commit11dc8042c691244a085c16396fce4a3a3e9bc186
tree3849aafeea6dda2a450d7826fabb7ba301abc028
parent58d378b24b7f615b779ec20e7b7eebed8a3d8011
xen/evtchn: fix ring resize when binding new events

commit 27e0e6385377c4dc68a4ddaf1a35a2dfa951f3c5 upstream.

The copying of ring data was wrong for two cases: For a full ring
nothing got copied at all (as in that case the canonicalized producer
and consumer indexes are identical). And in case one or both of the
canonicalized (after the resize) indexes would point into the second
half of the buffer, the copied data ended up in the wrong (free) part
of the new buffer. In both cases uninitialized data would get passed
back to the caller.

Fix this by simply copying the old ring contents twice: Once to the
low half of the new buffer, and a second time to the high half.

This addresses the inability to boot a HVM guest with 64 or more
vCPUs.  This regression was caused by 8620015499101090 (xen/evtchn:
dynamically grow pending event channel ring).

Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/xen/evtchn.c