From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: [PATCH 2/2] kexec: fail image loads if the page tables cannot be built Date: Wed, 13 Nov 2013 14:43:49 +0000 Message-ID: <1384353829-3917-3-git-send-email-david.vrabel@citrix.com> References: <1384353829-3917-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1384353829-3917-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: David Vrabel , Jan Beulich List-Id: xen-devel@lists.xenproject.org From: David Vrabel CID 1128566 If an image source page is allocated in kimage_alloc_page() but the machine_kexec_add_page() fails, the image may appear to load succesfully but it will not execute. The relocation will fault (rebooting the host) when trying to copy the source page, as it is not mapped. Signed-off-by: David Vrabel --- xen/common/kimage.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/xen/common/kimage.c b/xen/common/kimage.c index 5c3e3b3..91943f1 100644 --- a/xen/common/kimage.c +++ b/xen/common/kimage.c @@ -592,6 +592,7 @@ static struct page_info *kimage_alloc_page(struct kexec_image *image, */ struct page_info *page; paddr_t addr; + int ret; /* * Walk through the list of destination pages, and see if I have a @@ -656,7 +657,13 @@ static struct page_info *kimage_alloc_page(struct kexec_image *image, } } found: - machine_kexec_add_page(image, page_to_maddr(page), page_to_maddr(page)); + ret = machine_kexec_add_page(image, page_to_maddr(page), + page_to_maddr(page)); + if ( ret < 0 ) + { + free_domheap_page(page); + return NULL; + } return page; } -- 1.7.2.5