x86/mem-paging: correct p2m_mem_paging_prep()'s error handling
authorJan Beulich <jbeulich@suse.com>
Fri, 15 May 2020 14:01:06 +0000 (16:01 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 15 May 2020 14:01:06 +0000 (16:01 +0200)
commitecb913be4aaae0e01d6a65e8e1c1ac78816b8809
tree4be9d0ea35d9580e359126e16e4b022e29a92693
parentc2612852288c410846e41a7a882317e8bc55b9ff
x86/mem-paging: correct p2m_mem_paging_prep()'s error handling

Communicating errors from p2m_set_entry() to the caller is not enough:
Neither the M2P nor the stats updates should occur in such a case.
Instead the allocated page needs to be freed again; for cleanliness
reasons also properly take into account _PGC_allocated there.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/mm/p2m.c