]> git.ipfire.org Git - people/ms/linux.git/commit
xen/balloon: flush persistent kmaps in correct position
authorWei Liu <wei.liu2@citrix.com>
Sat, 15 Mar 2014 16:11:47 +0000 (16:11 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Apr 2014 19:02:35 +0000 (12:02 -0700)
commita0a7b1fa22feddc90b25f12aca70bf29a548031e
treeb5c56c15eb7a1eb911d546bba8b4a06366cd357f
parent7bad2a982359394a7d5fd5c7462b75d4d3ae95fc
xen/balloon: flush persistent kmaps in correct position

commit 09ed3d5ba06137913960f9c9385f71fc384193ab upstream.

Xen balloon driver will update ballooned out pages' P2M entries to point
to scratch page for PV guests. In 24f69373e2 ("xen/balloon: don't alloc
page while non-preemptible", kmap_flush_unused was moved after updating
P2M table. In that case for 32 bit PV guest we might end up with

  P2M    X -----> S  (S is mfn of balloon scratch page)
  M2P    Y -----> X  (Y is mfn in persistent kmap entry)

kmap_flush_unused() iterates through all the PTEs in the kmap address
space, using pte_to_page() to obtain the page. If the p2m and the m2p
are inconsistent the incorrect page is returned.  This will clear
page->address on the wrong page which may cause subsequent oopses if
that page is currently kmap'ed.

Move the flush back between get_page and __set_phys_to_machine to fix
this.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/xen/balloon.c