From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Vincent Whitchurch <vincent.whitchurch@axis.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
kernel@axis.com, Andy Shevchenko <andy.shevchenko@gmail.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tty: Fix lookahead_buf crash with serdev
Date: Tue, 16 Aug 2022 10:21:30 +0300 (EEST) [thread overview]
Message-ID: <27efed7a-6e1e-e151-35d5-6b4b8b9d2e8@linux.intel.com> (raw)
In-Reply-To: <20220816071142.1128001-1-vincent.whitchurch@axis.com>
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@axis.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.
prev parent reply other threads:[~2022-08-16 9:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 7:11 [PATCH] tty: Fix lookahead_buf crash with serdev Vincent Whitchurch
2022-08-16 7:21 ` Ilpo Järvinen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=27efed7a-6e1e-e151-35d5-6b4b8b9d2e8@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vincent.whitchurch@axis.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.