Re: proper tty-ldisc refcounting (was Re: WARNING at:drivers/char/tty_ldisc.c)

From: Sergey Senozhatsky
Date: Tue Aug 04 2009 - 05:09:57 EST


On (08/04/09 00:23), Greg KH wrote:
> On Mon, Aug 03, 2009 at 11:19:53PM -0700, Linus Torvalds wrote:
> >
> >
> > On Mon, 3 Aug 2009, Greg KH wrote:
> > >
> > > Oh wait, the original problem, single user mode. Hm, we need all of
> > > these to fix that problem? Or just the first one?
> >
> > Patches 1-3 should fix that one. 4-5 are just cleanups with no semantic
> > changes.
>
> Ok, but due to the lateness of the release cycle, is it worth it to add
> those 3 right now? Or do we just take the BUG_ON() out as it's pretty
> harmless while shutting down in single user mode?
>
> What do you think?
>

I don't think that take the BUG_ON out is the best we can do.

If I understand correctly, this one (tty_ldisc.c:209):
static void tty_ldisc_put(struct tty_ldisc *ld)
{
[...]
spin_unlock_irqrestore(&tty_ldisc_lock, flags);
- WARN_ON(ld->refcount);
kfree(ld);
}

It's better to leave everything as is in that case and wait 32 (to my mind).

"there may certainly be more tty breakage there too", Linus
and WARN_ON may be quite usefull.

Sergey

Attachment: signature.asc
Description: Digital signature