]> git.baikalelectronics.ru Git - kernel.git/commit
x86/xen: avoid race in p2m handling
authorJuergen Gross <jgross@suse.com>
Fri, 17 Oct 2014 11:16:06 +0000 (13:16 +0200)
committerDavid Vrabel <david.vrabel@citrix.com>
Thu, 23 Oct 2014 15:24:02 +0000 (16:24 +0100)
commitd61dc13301f9a001e8eb3be65f90655c343e5baf
tree4f74cec939084816caf4056097f0b382ea413ad5
parent2710bd787abaf6c6d78e706aa49375c72b851db2
x86/xen: avoid race in p2m handling

When a new p2m leaf is allocated this leaf is linked into the p2m tree
via cmpxchg. Unfortunately the compare value for checking the success
of the update is read after checking for the need of a new leaf. It is
possible that a new leaf has been linked into the tree concurrently
in between. This could lead to a leaked memory page and to the loss of
some p2m entries.

Avoid the race by using the read compare value for checking the need
of a new p2m leaf and use ACCESS_ONCE() to get it.

There are other places which seem to need ACCESS_ONCE() to ensure
proper operation. Change them accordingly.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
arch/x86/xen/p2m.c