]> git.baikalelectronics.ru Git - kernel.git/commit
xen/events: avoid race with raising an event in unmask_evtchn()
authorDavid Vrabel <david.vrabel@citrix.com>
Mon, 25 Mar 2013 14:11:19 +0000 (14:11 +0000)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 27 Mar 2013 16:06:04 +0000 (12:06 -0400)
commitbd35659650d4732f2c878cbd3aefe360a346e09f
tree839a4e5cea1aa3dbdcbc9f585106b24b360a655a
parent15561cd9aaecb54c2e20f8a61b0764a0d11f34f3
xen/events: avoid race with raising an event in unmask_evtchn()

In unmask_evtchn(), when the mask bit is cleared after testing for
pending and the event becomes pending between the test and clear, then
the upcall will not become pending and the event may be lost or
delayed.

Avoid this by always clearing the mask bit before checking for
pending.  If a hypercall is needed, remask the event as
EVTCHNOP_unmask will only retrigger pending events if they were
masked.

This fixes a regression introduced in 3.7 by
e10c1aa1c7365107e1635665ce9de5d45c51dea0 (xen/events: fix
unmask_evtchn for PV on HVM guests) which reordered the clear mask and
check pending operations.

Changes in v2:
- set mask before hypercall.

Cc: stable@vger.kernel.org
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/events.c