[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xenconsole fix



On Fri, Jul 07, 2006 at 12:24:50PM -0700, Pete Zaitcev wrote:
> On Fri, 7 Jul 2006 17:35:56 +0900, Isaku Yamahata <yamahata@xxxxxxxxxxxxx> 
> wrote:
> 
> > xenconsole fix. reference of tty->count in xencons_close() is racy.
> > It must be protected by tty_sem semaphore like con_close() in
> > drivers/char/vt.c
> 
> > +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c    Fri Jul 07 
> > 17:34:08 2006 +0900
> > @@ -536,6 +536,7 @@ static void xencons_close(struct tty_str
> >     if (DUMMY_TTY(tty))
> >             return;
> >  
> > +   down(&tty_sem);
> >     if (tty->count == 1) {
> >             tty->closing = 1;
> >             tty_wait_until_sent(tty, 0);
> ......
> >     }
> > +   up(&tty_sem);
> >  }
> 
> This is clearly not a safe idea. You do not know what the line
> discipline is going to do. If you are concerned about tty->count,
> then why don't you drop the mutex before all those convoluted
> functions get called?

You're right. It's daingerous. How about this patch?
Setting TTY_CLOSING is intrusinve.
But referencing tty->count is already intrusive.
-- 
yamahata

Attachment: 10648:747aaae397bf_add_tty_sem.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.