Subject: memory: don't implicitly unpin for decrease-reservation
From: Jan Beulich <[email-masked]>

It very likely was a mistake (copy-and-paste from domain cleanup code)
to implicitly unpin here: The caller should really unpin itself before
(or after, if they so wish) requesting the page to be removed.

This is XSA-252.

Reported-by: Jann Horn <[email-masked]>
Signed-off-by: Jan Beulich <[email-masked]>
Reviewed-by: Andrew Cooper <[email-masked]>

--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -320,9 +320,6 @@ int guest_remove_page(struct domain *d,
 
     rc = guest_physmap_remove_page(d, gmfn, mfn, 0);
 
-    if ( !rc && test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) )
-        put_page_and_type(page);
-
     /*
      * With the lack of an IOMMU on some platforms, domains with DMA-capable
      * device must retrieve the same pfn when the hypercall populate_physmap