lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 Apr 2022 19:03:19 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc:     linux-serial@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>,
        linux-kernel@...r.kernel.org,
        Gilles Buloz <gilles.buloz@...tron.com>,
        Johan Hovold <johan@...nel.org>
Subject: Re: [PATCH 1/2] tty: Add lookahead param to receive_buf

On Tue, Apr 05, 2022 at 01:24:36PM +0300, Ilpo Järvinen wrote:
> After lookahead for XON/XOFF characters is added by the next
> patch, the receive side needs to ensure the flow-control
> actions are not retaken later on when those same characters
> get read by TTY.
> 
> Thus, pass lookahead count to receive_buf and skip
> flow-control character actions if already taken for the
> character in question. Lookahead count will become live after
> the next patch.

...

> -static void n_tty_receive_char_special(struct tty_struct *tty, unsigned char c)
> +static void n_tty_receive_char_special(struct tty_struct *tty, unsigned char c,
> +				       bool lookahead_done)
>  {
>  	struct n_tty_data *ldata = tty->disc_data;
>  
>  	if (I_IXON(tty)) {
>  		if (c == START_CHAR(tty)) {
> -			start_tty(tty);
> -			process_echoes(tty);
> +			if (!lookahead_done) {
> +				start_tty(tty);
> +				process_echoes(tty);
> +			}
>  			return;
>  		}
>  		if (c == STOP_CHAR(tty)) {
> -			stop_tty(tty);
> +			if (!lookahead_done)
> +				stop_tty(tty);
>  			return;
>  		}

Wouldn't be cleaner to inside out the conditionals?

>  	}

	if (I_IXON(tty)) {
		if (lookahead_done) {
			// Can be joined, but I think this is better
			if (c == START_CHAR(tty))
				return;
			if (c == STOP_CHAR(tty))
				return;
		} else {
			if (c == START_CHAR(tty)) {
				start_tty(tty);
				process_echoes(tty);
				return;
			}
			if (c == STOP_CHAR(tty)) {
				stop_tty(tty);
				return;
			}
		}
	}

In my opinion this will show exactly what's going on when we have
lookahead_done and when not.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ