Re: [PATCH v3 07/23] tty: Strengthen no-subsequent-use guarantee of tty_ldisc_halt()

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

 



On Thu, 2013-02-07 at 16:38 +0100, Jiri Slaby wrote:
> On 02/05/2013 09:20 PM, Peter Hurley wrote:
> > @@ -688,9 +702,9 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
> >  	 *	parallel to the change and re-referencing the tty.
> >  	 */
> >  
> > -	work = tty_ldisc_halt(tty);
> > +	retval = tty_ldisc_halt(tty, &work, 5 * HZ);
> >  	if (o_tty)
> > -		o_work = tty_ldisc_halt(o_tty);
> > +		tty_ldisc_halt(o_tty, &o_work, 0);
> 
> Zero in there will cause the other end's work not to be cancelled and
> TTY_LDISC_HALTED unset if there are two or more readers on the slave,
> right? So there should be something like:
> if (timeout)
>   retval = tty_ldisc_wait_idle(tty, timeout);
>   ...
> 
> in tty_ldisc_halt.

True.

Fixed in 08/23, where both ldiscs are halted simultaneously, forced to
wait for identical timeouts, and returns an error if either tty timed
out. From 08/23

in tty_ldisc_halt():

        retval = tty_ldisc_wait_idle(tty, timeout);
+       if (!retval && o_tty)
+               retval = tty_ldisc_wait_idle(o_tty, timeout);
        if (retval)
                return retval;

in tty_set_ldisc():

-       retval = tty_ldisc_halt(tty, &work, 5 * HZ);
-       if (o_tty)
-               tty_ldisc_halt(o_tty, &o_work, 0);
+       retval = tty_ldisc_halt(tty, o_tty, &work, &o_work, 5 * HZ);


If you'd prefer, I could put the 5 sec. wait in 7/23 as well, test the
error and so forth.

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux