summaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2020-09-07 15:47:27 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-05 11:43:10 +0100
commit4bea575a10691a99b03d5e9055f3079040b59868 (patch)
tree40d8d2647c8dc609ff8a4516622c0853e7bddbc7 /drivers/xen
parenta01379671d67d34f254cc81f42cf854aa628f3a3 (diff)
downloadlinux-stable-4bea575a10691a99b03d5e9055f3079040b59868.tar.gz
linux-stable-4bea575a10691a99b03d5e9055f3079040b59868.tar.bz2
linux-stable-4bea575a10691a99b03d5e9055f3079040b59868.zip
xen/events: add a proper barrier to 2-level uevent unmasking
commit 4d3fe31bd993ef504350989786858aefdb877daa upstream. A follow-up patch will require certain write to happen before an event channel is unmasked. While the memory barrier is not strictly necessary for all the callers, the main one will need it. In order to avoid an extra memory barrier when using fifo event channels, mandate evtchn_unmask() to provide write ordering. The 2-level event handling unmask operation is missing an appropriate barrier, so add it. Fifo event channels are fine in this regard due to using sync_cmpxchg(). This is part of XSA-332. Cc: stable@vger.kernel.org Suggested-by: Julien Grall <julien@xen.org> Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Julien Grall <jgrall@amazon.com> Reviewed-by: Wei Liu <wl@xen.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/events/events_2l.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c
index 8edef51c92e5..e4b75693600e 100644
--- a/drivers/xen/events/events_2l.c
+++ b/drivers/xen/events/events_2l.c
@@ -91,6 +91,8 @@ static void evtchn_2l_unmask(unsigned port)
BUG_ON(!irqs_disabled());
+ smp_wmb(); /* All writes before unmask must be visible. */
+
if (unlikely((cpu != cpu_from_evtchn(port))))
do_hypercall = 1;
else {