[XEN] Check that the cr3 mfn is valid before using it.

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
This commit is contained in:
Christian Limpach committed 2007-03-01 17:27:31 +00:00
1 parent 9e1f289303
commit 631f828097
1 file changed
+10 -8
+10 -8
View File
@@ -630,10 +630,11 @@ int arch_set_info_guest(
{
cr3_pfn = gmfn_to_mfn(d, xen_cr3_to_pfn(c.nat->ctrlreg[3]));
if ( paging_mode_refcounts(d)
? !get_page(mfn_to_page(cr3_pfn), d)
: !get_page_and_type(mfn_to_page(cr3_pfn), d,
PGT_base_page_table) )
if ( !mfn_valid(cr3_pfn) ||
(paging_mode_refcounts(d)
? !get_page(mfn_to_page(cr3_pfn), d)
: !get_page_and_type(mfn_to_page(cr3_pfn), d,
PGT_base_page_table)) )
{
destroy_gdt(v);
return -EINVAL;
@@ -648,10 +649,11 @@ int arch_set_info_guest(
cr3_pfn = gmfn_to_mfn(d, compat_cr3_to_pfn(c.cmp->ctrlreg[3]));
if ( paging_mode_refcounts(d)
? !get_page(mfn_to_page(cr3_pfn), d)
: !get_page_and_type(mfn_to_page(cr3_pfn), d,
PGT_l3_page_table) )
if ( !mfn_valid(cr3_pfn) ||
(paging_mode_refcounts(d)
? !get_page(mfn_to_page(cr3_pfn), d)
: !get_page_and_type(mfn_to_page(cr3_pfn), d,
PGT_l3_page_table)) )
{
destroy_gdt(v);
return -EINVAL;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.