Re: [PATCH] Fix race/oops in tty layer after BKL pushdown

From: Alan Cox
Date: Mon Aug 11 2008 - 04:23:24 EST


> Please review and consider to apply:
>
> Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
> ---
> drivers/char/tty_io.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: kvm/drivers/char/tty_io.c
> ===================================================================
> --- kvm.orig/drivers/char/tty_io.c
> +++ kvm/drivers/char/tty_io.c
> @@ -1161,8 +1161,8 @@ void disassociate_ctty(int on_exit)
> tty = get_current_tty();
> if (tty) {
> tty_pgrp = get_pid(tty->pgrp);
> - mutex_unlock(&tty_mutex);
> lock_kernel();
> + mutex_unlock(&tty_mutex);
> /* XXX: here we race, there is nothing protecting tty */
> if (on_exit && tty->driver->type != TTY_DRIVER_TYPE_PTY)
> tty_vhangup(tty);

For upstream (see -next tree) I have pushed a refcounting solution (or at
least I hope its a solution) to the ttydev tree. For 2.6.26 your approach
partially fixes this and certainly doesn't make it worse so I'll now push
it onwards.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/