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] [day] [month] [year] [list]
Date:   Tue, 16 Aug 2022 10:21:30 +0300 (EEST)
From:   Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To:     Vincent Whitchurch <vincent.whitchurch@...s.com>
cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>, kernel@...s.com,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tty: Fix lookahead_buf crash with serdev

On Tue, 16 Aug 2022, Vincent Whitchurch wrote:

> Do not follow a NULL pointer if the tty_port_client_operations does not
> implement the ->lookahead_buf() callback, which is the case with
> serdev's ttyport.
> 
> Fixes: 6bb6fa6908ebd3 ("tty: Implement lookahead to process XON/XOFF timely")
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@...s.com>
> ---
>  drivers/tty/tty_buffer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
> index 9fdecc795b6b..a1c97d4a45fb 100644
> --- a/drivers/tty/tty_buffer.c
> +++ b/drivers/tty/tty_buffer.c
> @@ -493,7 +493,8 @@ static void lookahead_bufs(struct tty_port *port, struct tty_buffer *head)
>  		if (~head->flags & TTYB_NORMAL)
>  			f = flag_buf_ptr(head, head->lookahead);
>  
> -		port->client_ops->lookahead_buf(port, p, f, count);
> +		if (port->client_ops->lookahead_buf)
> +			port->client_ops->lookahead_buf(port, p, f, count);

While this works, I'd put the preceeding calculations of p and f into the 
same block as they just prep parameters for the call.

>  		head->lookahead += count;
>  	}
>  }
> 

-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ