summaryrefslogtreecommitdiffstats
path: root/drivers/lguest/core.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-10-22 11:03:35 +1000
committerRusty Russell <rusty@rustcorp.com.au>2007-10-23 15:49:53 +1000
commitc18acd73ffc209def08003a1927473096f66c5ad (patch)
treedd8e292ac8ca90b061b7e37ad6947231ced566e3 /drivers/lguest/core.c
parentee3db0f2b6053b65f3b70253f5f810d9a3d67b28 (diff)
downloadlinux-c18acd73ffc209def08003a1927473096f66c5ad.tar.gz
linux-c18acd73ffc209def08003a1927473096f66c5ad.tar.bz2
linux-c18acd73ffc209def08003a1927473096f66c5ad.zip
Allow guest to specify syscall vector to use.
(Based on Ron Minnich's LGUEST_PLAN9_SYSCALL patch). This patch allows Guests to specify what system call vector they want, and we try to reserve it. We only allow one non-Linux system call vector, to try to avoid DoS on the Host. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/core.c')
-rw-r--r--drivers/lguest/core.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 02556bae9e9f..41b26e592d38 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -281,37 +281,47 @@ static int __init init(void)
/* First we put the Switcher up in very high virtual memory. */
err = map_switcher();
if (err)
- return err;
+ goto out;
/* Now we set up the pagetable implementation for the Guests. */
err = init_pagetables(switcher_page, SHARED_SWITCHER_PAGES);
- if (err) {
- unmap_switcher();
- return err;
- }
+ if (err)
+ goto unmap;
/* The I/O subsystem needs some things initialized. */
lguest_io_init();
+ /* We might need to reserve an interrupt vector. */
+ err = init_interrupts();
+ if (err)
+ goto free_pgtables;
+
/* /dev/lguest needs to be registered. */
err = lguest_device_init();
- if (err) {
- free_pagetables();
- unmap_switcher();
- return err;
- }
+ if (err)
+ goto free_interrupts;
/* Finally we do some architecture-specific setup. */
lguest_arch_host_init();
/* All good! */
return 0;
+
+free_interrupts:
+ free_interrupts();
+free_pgtables:
+ free_pagetables();
+unmap:
+ unmap_switcher();
+out:
+ return err;
}
/* Cleaning up is just the same code, backwards. With a little French. */
static void __exit fini(void)
{
lguest_device_remove();
+ free_interrupts();
free_pagetables();
unmap_switcher();