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>] [day] [month] [year] [list]
Message-ID: <X/couq0YmTE8ypTn@kroah.com>
Date:   Thu, 7 Jan 2021 16:28:58 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     zhangqiumiao1@...ei.com
Cc:     jirislaby@...nel.org, linux-kernel@...r.kernel.org,
        zhangqiumiao <zhangqiumiao1@...wei.com>
Subject: Re: [PATCH] tty: fix timeout equals to 0 problem in tty_ioctl

On Sat, Dec 19, 2020 at 11:27:31AM +0800, zhangqiumiao1@...ei.com wrote:
> From: zhangqiumiao <zhangqiumiao1@...wei.com>
> 
> Fix the problem that tty buffer data was not flushed when timeout=0.

How can that happen?  We need a lot better changelog text here please.

> 
> Signed-off-by: zhangqiumiao <zhangqiumiao1@...wei.com>

I need a "full" name here, please.

> ---
>  drivers/tty/tty_ioctl.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
> index 4de1c6ddb8ff..f9d4b6e22308 100644
> --- a/drivers/tty/tty_ioctl.c
> +++ b/drivers/tty/tty_ioctl.c
> @@ -220,13 +220,21 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout)
>  	tty_debug_wait_until_sent(tty, "wait until sent, timeout=%ld\n", timeout);
>  
>  	if (!timeout)
> -		timeout = MAX_SCHEDULE_TIMEOUT;
> +		timeout = 60 * HZ;

Why pick this random number?

>  
>  	timeout = wait_event_interruptible_timeout(tty->write_wait,
>  			!tty_chars_in_buffer(tty), timeout);
> -	if (timeout <= 0)
> +	if (timeout < 0)
>  		return;
>  
> +	if (timeout == 0) {
> +		if (tty->ops->flush_buffer) {
> +			pr_info("%s: flush buffer\n", __func__);

Debugging code needs to be removed.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ