From: Jan Beulich Date: Wed, 20 May 2020 10:49:28 +0000 (+0200) Subject: x86/mem-paging: further adjustments to p2m_mem_paging_prep()'s error handling X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~223 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cdea123f1976549ecc72644588cc5ce1491606c4;p=xen.git x86/mem-paging: further adjustments to p2m_mem_paging_prep()'s error handling Address late comments on ecb913be4aaa ("x86/mem-paging: correct p2m_mem_paging_prep()'s error handling"): - insert a gprintk() ahead of domain_crash(), - add a comment. Requested-by: Andrew Cooper Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/mm/mem_paging.c b/xen/arch/x86/mm/mem_paging.c index 6aa1bffa65..01281f786e 100644 --- a/xen/arch/x86/mm/mem_paging.c +++ b/xen/arch/x86/mm/mem_paging.c @@ -385,6 +385,9 @@ static int prepare(struct domain *d, gfn_t gfn, * The domain can't possibly know about this page yet, so failure * here is a clear indication of something fishy going on. */ + gprintk(XENLOG_ERR, + "%pd: fresh page for GFN %"PRI_gfn" in unexpected state\n", + d, gfn_x(gfn)); domain_crash(d); page = NULL; goto out; @@ -423,6 +426,10 @@ static int prepare(struct domain *d, gfn_t gfn, if ( page ) { + /* + * Free the page on error. Drop our temporary reference in all + * cases. + */ if ( ret ) put_page_alloc_ref(page); put_page(page);