[Lguest] [PATCH] lguest: make sure cpu is initialized before accessing it

Rusty Russell rusty at rustcorp.com.au
Tue Mar 4 11:19:44 EST 2008


On Tuesday 04 March 2008 10:15:47 Rusty Russell wrote:
> On Sunday 10 February 2008 02:53:17 Eugene Teo wrote:
> > If req is LHREQ_INITIALIZE, and the guest has been initialized before
> > (unlikely), it will attempt to access cpu->tsk even though cpu is not yet
> > initialized.
> >
> > Signed-off-by: Eugene Teo <eugeneteo at kernel.sg>

Thanks Eugene, I've applied this with some wrapping of the comments and 
removal of the now-redundant lg != NULL tests:

> > +		/* Once the Guest is dead, all you can do is read() why it died. */
> > +		if (lg && lg->dead)
> > +			return -ENOENT;
> >
> > -	/* If you're not the task which owns the Guest, you can only break */
> > -	if (lg && current != cpu->tsk && req != LHREQ_BREAK)
> > -		return -EPERM;
> > +		/* If you're not the task which owns the Guest, you can only break */
> > +		if (lg && current != cpu->tsk && req != LHREQ_BREAK)
> > +			return -EPERM;
> > +	}

Cheers,
Rusty.



More information about the Lguest mailing list