x86/mm: Rework get_page_and_type_from_mfn conditional
authorGeorge Dunlap <george.dunlap@citrix.com>
Thu, 10 Oct 2019 16:57:49 +0000 (17:57 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 31 Oct 2019 15:13:23 +0000 (16:13 +0100)
commit2aab06d742e13d7a9d248f1fc7f0ec62b295ada1
tree418835ed060dc050ac4576de82433df26667d2a3
parent0121588ec0f6950ed65d906d860df49be2c8e655
x86/mm: Rework get_page_and_type_from_mfn conditional

Make it easier to read by declaring the conditions in which we will
retain the ref, rather than the conditions under which we release it.

The only way (page == current->arch.old_guest_table) can be true is if
preemptible is true; so remove this from the query itself, and add an
ASSERT() to that effect on the opposite path.

No functional change intended.

NB that alloc_lN_table() mishandle the "linear pt failure" situation
described in the comment; this will be addressed in a future patch.

This is part of XSA-299.

Reported-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm.c