aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/hypercalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lguest/hypercalls.c')
-rw-r--r--drivers/lguest/hypercalls.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 5ecd60b54201..02e67b49ea4f 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -205,16 +205,19 @@ static void initialize(struct lguest *lg)
205 tsc_speed = 0; 205 tsc_speed = 0;
206 206
207 /* The pointer to the Guest's "struct lguest_data" is the only 207 /* The pointer to the Guest's "struct lguest_data" is the only
208 * argument. */ 208 * argument. We check that address now. */
209 lg->lguest_data = (struct lguest_data __user *)lg->regs->edx;
210 /* If we check the address they gave is OK now, we can simply
211 * copy_to_user/from_user from now on rather than using lgread/lgwrite.
212 * I put this in to show that I'm not immune to writing stupid
213 * optimizations. */
214 if (!lguest_address_ok(lg, lg->regs->edx, sizeof(*lg->lguest_data))) { 209 if (!lguest_address_ok(lg, lg->regs->edx, sizeof(*lg->lguest_data))) {
215 kill_guest(lg, "bad guest page %p", lg->lguest_data); 210 kill_guest(lg, "bad guest page %p", lg->lguest_data);
216 return; 211 return;
217 } 212 }
213
214 /* Having checked it, we simply set lg->lguest_data to point straight
215 * into the Launcher's memory at the right place and then use
216 * copy_to_user/from_user from now on, instead of lgread/write. I put
217 * this in to show that I'm not immune to writing stupid
218 * optimizations. */
219 lg->lguest_data = lg->mem_base + lg->regs->edx;
220
218 /* The Guest tells us where we're not to deliver interrupts by putting 221 /* The Guest tells us where we're not to deliver interrupts by putting
219 * the range of addresses into "struct lguest_data". */ 222 * the range of addresses into "struct lguest_data". */
220 if (get_user(lg->noirq_start, &lg->lguest_data->noirq_start) 223 if (get_user(lg->noirq_start, &lg->lguest_data->noirq_start)