0202-serial-Take-care-starting-a-hung-up-tty-s-port.patch 986 B

12345678910111213141516171819202122232425262728
  1. From 35370cf396896477ee7e8cb044779a3ee9257a7e Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <phil@raspberrypi.org>
  3. Date: Wed, 9 Mar 2016 13:28:24 +0000
  4. Subject: [PATCH 202/381] serial: Take care starting a hung-up tty's port
  5. tty_port_hangup sets a port's tty field to NULL (holding the port lock),
  6. but uart_tx_stopped, called from __uart_start (with the port lock),
  7. uses the tty field without checking for NULL.
  8. Change uart_tx_stopped to treat a NULL tty field as another stopped
  9. indication.
  10. Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  11. ---
  12. include/linux/serial_core.h | 2 +-
  13. 1 file changed, 1 insertion(+), 1 deletion(-)
  14. --- a/include/linux/serial_core.h
  15. +++ b/include/linux/serial_core.h
  16. @@ -397,7 +397,7 @@ int uart_resume_port(struct uart_driver
  17. static inline int uart_tx_stopped(struct uart_port *port)
  18. {
  19. struct tty_struct *tty = port->state->port.tty;
  20. - if (tty->stopped || port->hw_stopped)
  21. + if (!tty || tty->stopped || port->hw_stopped)
  22. return 1;
  23. return 0;
  24. }