Skip to content

Commit 26c019f

Browse files
committed
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
2 parents 31795c4 + 2332575 commit 26c019f

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

drivers/tty/n_tty.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,8 +1758,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
17581758
canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON;
17591759
if (canon_change) {
17601760
bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
1761-
ldata->line_start = 0;
1762-
ldata->canon_head = ldata->read_tail;
1761+
ldata->line_start = ldata->canon_head = ldata->read_tail;
17631762
ldata->erasing = 0;
17641763
ldata->lnext = 0;
17651764
}

drivers/tty/serial/pch_uart.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -667,30 +667,21 @@ static int pop_tx_x(struct eg20t_port *priv, unsigned char *buf)
667667

668668
static int dma_push_rx(struct eg20t_port *priv, int size)
669669
{
670-
struct tty_struct *tty;
671670
int room;
672671
struct uart_port *port = &priv->port;
673672
struct tty_port *tport = &port->state->port;
674673

675-
port = &priv->port;
676-
tty = tty_port_tty_get(tport);
677-
if (!tty) {
678-
dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
679-
return 0;
680-
}
681-
682674
room = tty_buffer_request_room(tport, size);
683675

684676
if (room < size)
685677
dev_warn(port->dev, "Rx overrun: dropping %u bytes\n",
686678
size - room);
687679
if (!room)
688-
return room;
680+
return 0;
689681

690682
tty_insert_flip_string(tport, sg_virt(&priv->sg_rx), size);
691683

692684
port->icount.rx += room;
693-
tty_kref_put(tty);
694685

695686
return room;
696687
}
@@ -1098,6 +1089,8 @@ static void pch_uart_err_ir(struct eg20t_port *priv, unsigned int lsr)
10981089
if (tty == NULL) {
10991090
for (i = 0; error_msg[i] != NULL; i++)
11001091
dev_err(&priv->pdev->dev, error_msg[i]);
1092+
} else {
1093+
tty_kref_put(tty);
11011094
}
11021095
}
11031096

drivers/tty/serial/serial-tegra.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ static irqreturn_t tegra_uart_isr(int irq, void *data)
732732
static void tegra_uart_stop_rx(struct uart_port *u)
733733
{
734734
struct tegra_uart_port *tup = to_tegra_uport(u);
735-
struct tty_struct *tty = tty_port_tty_get(&tup->uport.state->port);
735+
struct tty_struct *tty;
736736
struct tty_port *port = &u->state->port;
737737
struct dma_tx_state state;
738738
unsigned long ier;
@@ -744,6 +744,8 @@ static void tegra_uart_stop_rx(struct uart_port *u)
744744
if (!tup->rx_in_progress)
745745
return;
746746

747+
tty = tty_port_tty_get(&tup->uport.state->port);
748+
747749
tegra_uart_wait_sym_time(tup, 1); /* wait a character interval */
748750

749751
ier = tup->ier_shadow;

drivers/tty/tty_ioctl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,9 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
12011201
}
12021202
return 0;
12031203
case TCFLSH:
1204+
retval = tty_check_change(tty);
1205+
if (retval)
1206+
return retval;
12041207
return __tty_perform_flush(tty, arg);
12051208
default:
12061209
/* Try the mode commands */

0 commit comments

Comments
 (0)