x86/gdt: Drop write-only, xalloc()'d array from set_gdt()

It is not used, and can cause a spurious failure of the set_gdt() hypercall in
low memory situations.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
master commit: a7bd9b1661
master date: 2015-08-05 10:32:45 +0100
This commit is contained in:
Andrew Cooper authored and Jan Beulich committed 2015-09-10 15:49:59 +02:00
1 parent ff9758b54f
commit 23c132291d
1 file changed
+2 -9
+2 -9
View File
@@ -4361,20 +4361,15 @@ long set_gdt(struct vcpu *v,
l1_pgentry_t *pl1e;
/* NB. There are 512 8-byte entries per GDT page. */
int i, nr_pages = (entries + 511) / 512;
unsigned long mfn, *pfns;
if ( entries > FIRST_RESERVED_GDT_ENTRY )
return -EINVAL;
pfns = xmalloc_array(unsigned long, nr_pages);
if ( !pfns )
return -ENOMEM;
/* Check the pages in the new GDT. */
for ( i = 0; i < nr_pages; i++ )
{
struct page_info *page;
pfns[i] = frames[i];
page = get_page_from_gfn(d, frames[i], NULL, P2M_ALLOC);
if ( !page )
goto fail;
@@ -4383,7 +4378,7 @@ long set_gdt(struct vcpu *v,
put_page(page);
goto fail;
}
mfn = frames[i] = page_to_mfn(page);
frames[i] = page_to_mfn(page);
}
/* Tear down the old GDT. */
@@ -4398,7 +4393,6 @@ long set_gdt(struct vcpu *v,
l1e_write(&pl1e[i], l1e_from_pfn(frames[i], __PAGE_HYPERVISOR));
}
xfree(pfns);
return 0;
fail:
@@ -4406,7 +4400,6 @@ long set_gdt(struct vcpu *v,
{
put_page_and_type(mfn_to_page(frames[i]));
}
xfree(pfns);
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.