Commit 26c019fc85698840ad934a223daf5734c9fa20cb

Authored by Linus Torvalds

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

Showing 6 changed files Side-by-side Diff

Documentation/devicetree/bindings/serial/qca,ar9330-uart.txt
  1 +* Qualcomm Atheros AR9330 High-Speed UART
  2 +
  3 +Required properties:
  4 +
  5 +- compatible: Must be "qca,ar9330-uart"
  6 +
  7 +- reg: Specifies the physical base address of the controller and
  8 + the length of the memory mapped region.
  9 +
  10 +- interrupt-parent: The phandle for the interrupt controller that
  11 + services interrupts for this device.
  12 +
  13 +- interrupts: Specifies the interrupt source of the parent interrupt
  14 + controller. The format of the interrupt specifier depends on the
  15 + parent interrupt controller.
  16 +
  17 +Additional requirements:
  18 +
  19 + Each UART port must have an alias correctly numbered in "aliases"
  20 + node.
  21 +
  22 +Example:
  23 +
  24 + aliases {
  25 + serial0 = &uart0;
  26 + };
  27 +
  28 + uart0: uart@18020000 {
  29 + compatible = "qca,ar9330-uart";
  30 + reg = <0x18020000 0x14>;
  31 +
  32 + interrupt-parent = <&intc>;
  33 + interrupts = <3>;
  34 + };
Documentation/devicetree/bindings/tty/serial/qca,ar9330-uart.txt
1   -* Qualcomm Atheros AR9330 High-Speed UART
2   -
3   -Required properties:
4   -
5   -- compatible: Must be "qca,ar9330-uart"
6   -
7   -- reg: Specifies the physical base address of the controller and
8   - the length of the memory mapped region.
9   -
10   -- interrupt-parent: The phandle for the interrupt controller that
11   - services interrupts for this device.
12   -
13   -- interrupts: Specifies the interrupt source of the parent interrupt
14   - controller. The format of the interrupt specifier depends on the
15   - parent interrupt controller.
16   -
17   -Additional requirements:
18   -
19   - Each UART port must have an alias correctly numbered in "aliases"
20   - node.
21   -
22   -Example:
23   -
24   - aliases {
25   - serial0 = &uart0;
26   - };
27   -
28   - uart0: uart@18020000 {
29   - compatible = "qca,ar9330-uart";
30   - reg = <0x18020000 0x14>;
31   -
32   - interrupt-parent = <&intc>;
33   - interrupts = <3>;
34   - };
... ... @@ -1758,8 +1758,7 @@
1758 1758 canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON;
1759 1759 if (canon_change) {
1760 1760 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;
1763 1762 ldata->erasing = 0;
1764 1763 ldata->lnext = 0;
1765 1764 }
drivers/tty/serial/pch_uart.c
... ... @@ -667,30 +667,21 @@
667 667  
668 668 static int dma_push_rx(struct eg20t_port *priv, int size)
669 669 {
670   - struct tty_struct *tty;
671 670 int room;
672 671 struct uart_port *port = &priv->port;
673 672 struct tty_port *tport = &port->state->port;
674 673  
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   -
682 674 room = tty_buffer_request_room(tport, size);
683 675  
684 676 if (room < size)
685 677 dev_warn(port->dev, "Rx overrun: dropping %u bytes\n",
686 678 size - room);
687 679 if (!room)
688   - return room;
  680 + return 0;
689 681  
690 682 tty_insert_flip_string(tport, sg_virt(&priv->sg_rx), size);
691 683  
692 684 port->icount.rx += room;
693   - tty_kref_put(tty);
694 685  
695 686 return room;
696 687 }
... ... @@ -1098,6 +1089,8 @@
1098 1089 if (tty == NULL) {
1099 1090 for (i = 0; error_msg[i] != NULL; i++)
1100 1091 dev_err(&priv->pdev->dev, error_msg[i]);
  1092 + } else {
  1093 + tty_kref_put(tty);
1101 1094 }
1102 1095 }
1103 1096  
drivers/tty/serial/serial-tegra.c
... ... @@ -732,7 +732,7 @@
732 732 static void tegra_uart_stop_rx(struct uart_port *u)
733 733 {
734 734 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;
736 736 struct tty_port *port = &u->state->port;
737 737 struct dma_tx_state state;
738 738 unsigned long ier;
... ... @@ -743,6 +743,8 @@
743 743  
744 744 if (!tup->rx_in_progress)
745 745 return;
  746 +
  747 + tty = tty_port_tty_get(&tup->uport.state->port);
746 748  
747 749 tegra_uart_wait_sym_time(tup, 1); /* wait a character interval */
748 750  
drivers/tty/tty_ioctl.c
... ... @@ -1201,6 +1201,9 @@
1201 1201 }
1202 1202 return 0;
1203 1203 case TCFLSH:
  1204 + retval = tty_check_change(tty);
  1205 + if (retval)
  1206 + return retval;
1204 1207 return __tty_perform_flush(tty, arg);
1205 1208 default:
1206 1209 /* Try the mode commands */