[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220816071142.1128001-1-vincent.whitchurch@axis.com>
Date: Tue, 16 Aug 2022 09:11:41 +0200
From: Vincent Whitchurch <vincent.whitchurch@...s.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>
CC: <kernel@...s.com>,
Vincent Whitchurch <vincent.whitchurch@...s.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] tty: Fix lookahead_buf crash with serdev
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);
head->lookahead += count;
}
}
--
2.34.1
Powered by blists - more mailing lists