Messages in this thread | | | Subject | Re: tty_mutex and tty_old_pgrp | From | Alan Cox <> | Date | Wed, 28 Jun 2006 11:24:00 +0100 |
| |
Ar Maw, 2006-06-27 am 23:29 -0400, ysgrifennodd Jon Smirl: > Why does this need to be protected? exit.c > mutex_lock(&tty_mutex); > current->signal->tty = NULL; > mutex_unlock(&tty_mutex);
It races against things like a third party haungup of the controlling tty session if the lock is not held.
> After looking at all of this for a couple of hours it looks to me like > tty_mutex could be removed if ref counts were used to control when the > tty_struct gets destroyed.
You would still want memory barriers and to audit the time things took effect as there is a fairly defined ordering involved here. Fully refcounting ttys would not be a bad thing but would require some driver work because the driver level objects hung off a tty are often not dynamically allocated and are not themselves refcounted so would get corrupted if the tty object was freed and a new one allocated and opened in the meantime.
Alan
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |