From bc6595da1a5cacee189bc83ea972a125f76f65e9 Mon Sep 17 00:00:00 2001 From: Tim Deegan Date: Wed, 16 Feb 2011 09:48:05 +0000 Subject: [PATCH] x86/shadow: unconditionally set the p2m/log-dirty allocation functions. Otherwise enabling log-dirty mode on a PV guest that already has a shadow allocation can leave the alloc/free functions pointers NULL, and later try to dereference them. Signed-off-by: Tim Deegan --- xen/arch/x86/mm/shadow/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index dd9a1555ae..5e5f9c16dc 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -3337,12 +3337,12 @@ static int shadow_one_bit_enable(struct domain *d, u32 mode) sh_set_allocation(d, 0, NULL); return -ENOMEM; } - - /* Allow p2m and log-dirty code to borrow shadow memory */ - d->arch.paging.alloc_page = shadow_alloc_p2m_page; - d->arch.paging.free_page = shadow_free_p2m_page; } + /* Allow p2m and log-dirty code to borrow shadow memory */ + d->arch.paging.alloc_page = shadow_alloc_p2m_page; + d->arch.paging.free_page = shadow_free_p2m_page; + if ( d->arch.paging.mode == 0 ) { /* Init the shadow hash table */ -- 2.39.5