Like on the Arm side, return -EINVAL when attempting to do a p2m
operation on dying domains.

The current logic returns 0 and leaves the domctl parameter
uninitialized for any parameter fetching operations (like the
GET_ALLOCATION operation), which is not helpful from a toolstack point
of view, because there's no indication that the data hasn't been
fetched.

Reported-by: Edwin Török <edvin.to...@citrix.com>
Signed-off-by: Roger Pau Monné <roger....@citrix.com>
---
I'm adding the for-4.17 tag because I think this is a backport
candidate to older Xen versions also.
---
 xen/arch/x86/mm/paging.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 3a355eee9c..3e7be07e86 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -694,9 +694,10 @@ int paging_domctl(struct domain *d, struct 
xen_domctl_shadow_op *sc,
 
     if ( unlikely(d->is_dying) )
     {
-        gdprintk(XENLOG_INFO, "Ignoring paging op on dying domain %u\n",
+        gdprintk(XENLOG_INFO,
+                 "Tried to do a paging domctl op on dying domain %u\n",
                  d->domain_id);
-        return 0;
+        return -EINVAL;
     }
 
     if ( unlikely(d->vcpu == NULL) || unlikely(d->vcpu[0] == NULL) )
-- 
2.37.3


Reply via email to