From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Cc: kernel@axis.com,
"Vincent Whitchurch" <vincent.whitchurch@axis.com>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] tty: Fix lookahead_buf crash with serdev
Date: Tue, 16 Aug 2022 09:11:41 +0200 [thread overview]
Message-ID: <20220816071142.1128001-1-vincent.whitchurch@axis.com> (raw)
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);
head->lookahead += count;
}
}
--
2.34.1
next reply other threads:[~2022-08-16 9:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 7:11 Vincent Whitchurch [this message]
2022-08-16 7:21 ` Ilpo Järvinen
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=20220816071142.1128001-1-vincent.whitchurch@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=andy.shevchenko@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®