Subject: Re: tty_lock not held during ppp setup
To: Iain Hibbert <plunky@rya-online.net>
From: Andrew Doran <ad@netbsd.org>
List: current-users
Date: 11/28/2007 21:44:54
On Wed, Nov 28, 2007 at 09:37:39PM +0000, Iain Hibbert wrote:

> I'm guessing pppstart needs to apply use of tty_lock but I'm not sure how
> extensive that ought to be..

Should cover nearly all of the ppp code and a whole lot more of the
tty devices, but someone(tm) needs to do that. :-)

>  the below works
> 
> --- /usr/src/sys/net/ppp_tty.c	2007-11-26 21:10:59.000000000 +0000
> +++ ppp_tty.c	2007-11-28 21:31:11.000000000 +0000
> @@ -912,8 +912,10 @@
>       * If there is stuff in the output queue, send it now.
>       * We are being called in lieu of ttstart and must do what it would.
>       */
> +    mutex_spin_enter(&tty_lock);
>      if (tp->t_oproc != NULL)
>  	(*tp->t_oproc)(tp);
> +    mutex_spin_exit(&tty_lock);
> 
>      /*
>       * If the transmit queue has drained and the tty has not hung up
> 
> but is it enough - Andrew?

There are one of two other places that need the lock - I have just checked
in a fix.

Thanks,
Andrew