TTY/Serial fixes for 3.12-rc3

Here are some serial at tty driver fixes for 3.12-rc3
 
 The serial driver fixes some kref leaks, documentation is moved to the proper
 places, and the tty and n_tty fixes resolve some reported regressions.  There
 is still one outstanding tty regression fix that isn't in here yet, as I want
 to test it out some more, it will be sent for 3.12-rc4 if it checks out.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.21 (GNU/Linux)
 
 iEYEABECAAYFAlJIhfAACgkQMUfUDdst+yl+ywCdEKd9jfuZhU0RZ+j3wJIHXwBM
 WFwAoIUPOI0CqKM1cLC/YIZwyn/pKjfY
 =zkas
 -----END PGP SIGNATURE-----

Merge tag 'tty-3.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial fixes from Greg KH:
 "Here are some serial at tty driver fixes for 3.12-rc3

  The serial driver fixes some kref leaks, documentation is moved to the
  proper places, and the tty and n_tty fixes resolve some reported
  regressions.  There is still one outstanding tty regression fix that
  isn't in here yet, as I want to test it out some more, it will be sent
  for 3.12-rc4 if it checks out"

* tag 'tty-3.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: ar933x_uart: move devicetree binding documentation
  tty: Fix SIGTTOU not sent with tcflush()
  n_tty: Fix EOF push index when termios changes
  serial: pch_uart: remove unnecessary tty_port_tty_get
  serial: pch_uart: fix tty-kref leak in dma-rx path
  serial: pch_uart: fix tty-kref leak in rx-error path
  serial: tegra: fix tty-kref leak
This commit is contained in:
Linus Torvalds 2013-09-29 13:47:00 -07:00
commit 26c019fc85
5 changed files with 10 additions and 13 deletions

View file

@ -1758,8 +1758,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON; canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON;
if (canon_change) { if (canon_change) {
bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE); bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
ldata->line_start = 0; ldata->line_start = ldata->canon_head = ldata->read_tail;
ldata->canon_head = ldata->read_tail;
ldata->erasing = 0; ldata->erasing = 0;
ldata->lnext = 0; ldata->lnext = 0;
} }

View file

@ -667,30 +667,21 @@ static int pop_tx_x(struct eg20t_port *priv, unsigned char *buf)
static int dma_push_rx(struct eg20t_port *priv, int size) static int dma_push_rx(struct eg20t_port *priv, int size)
{ {
struct tty_struct *tty;
int room; int room;
struct uart_port *port = &priv->port; struct uart_port *port = &priv->port;
struct tty_port *tport = &port->state->port; struct tty_port *tport = &port->state->port;
port = &priv->port;
tty = tty_port_tty_get(tport);
if (!tty) {
dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
return 0;
}
room = tty_buffer_request_room(tport, size); room = tty_buffer_request_room(tport, size);
if (room < size) if (room < size)
dev_warn(port->dev, "Rx overrun: dropping %u bytes\n", dev_warn(port->dev, "Rx overrun: dropping %u bytes\n",
size - room); size - room);
if (!room) if (!room)
return room; return 0;
tty_insert_flip_string(tport, sg_virt(&priv->sg_rx), size); tty_insert_flip_string(tport, sg_virt(&priv->sg_rx), size);
port->icount.rx += room; port->icount.rx += room;
tty_kref_put(tty);
return room; return room;
} }
@ -1098,6 +1089,8 @@ static void pch_uart_err_ir(struct eg20t_port *priv, unsigned int lsr)
if (tty == NULL) { if (tty == NULL) {
for (i = 0; error_msg[i] != NULL; i++) for (i = 0; error_msg[i] != NULL; i++)
dev_err(&priv->pdev->dev, error_msg[i]); dev_err(&priv->pdev->dev, error_msg[i]);
} else {
tty_kref_put(tty);
} }
} }

View file

@ -732,7 +732,7 @@ static irqreturn_t tegra_uart_isr(int irq, void *data)
static void tegra_uart_stop_rx(struct uart_port *u) static void tegra_uart_stop_rx(struct uart_port *u)
{ {
struct tegra_uart_port *tup = to_tegra_uport(u); struct tegra_uart_port *tup = to_tegra_uport(u);
struct tty_struct *tty = tty_port_tty_get(&tup->uport.state->port); struct tty_struct *tty;
struct tty_port *port = &u->state->port; struct tty_port *port = &u->state->port;
struct dma_tx_state state; struct dma_tx_state state;
unsigned long ier; unsigned long ier;
@ -744,6 +744,8 @@ static void tegra_uart_stop_rx(struct uart_port *u)
if (!tup->rx_in_progress) if (!tup->rx_in_progress)
return; return;
tty = tty_port_tty_get(&tup->uport.state->port);
tegra_uart_wait_sym_time(tup, 1); /* wait a character interval */ tegra_uart_wait_sym_time(tup, 1); /* wait a character interval */
ier = tup->ier_shadow; ier = tup->ier_shadow;

View file

@ -1201,6 +1201,9 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
} }
return 0; return 0;
case TCFLSH: case TCFLSH:
retval = tty_check_change(tty);
if (retval)
return retval;
return __tty_perform_flush(tty, arg); return __tty_perform_flush(tty, arg);
default: default:
/* Try the mode commands */ /* Try the mode commands */