aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 11:22:50 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 11:22:50 -0400
commitccf791e5e6b16477b196e81b85f7d5a067e0c8d9 (patch)
tree5c79d2f8819ba283fa3e9bdf770c22a402b3d3c8
parentfc0c8146680e362ebeaed0294b869425cc18230e (diff)
parent7e620984b62532783912312e334f3c48cdacbd5d (diff)
Merge tag 'tty-4.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
I wrote: "TTY/Serial driver fixes for 4.19-rc6 Here are a number of small tty and serial driver fixes for reported issues for 4.19-rc6. One should hopefully resolve a much-reported issue that syzbot has found in the tty layer. Although there are still more issues there, getting this fixed is nice to see finally happen. All of these have been in linux-next for a while with no reported issues." * tag 'tty-4.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: imx: restore handshaking irq for imx1 tty: vt_ioctl: fix potential Spectre v1 tty: Drop tty->count on tty_reopen() failure serial: cpm_uart: return immediately from console poll tty: serial: lpuart: avoid leaking struct tty_struct serial: mvebu-uart: Fix reporting of effective CSIZE to userspace
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_core.c10
-rw-r--r--drivers/tty/serial/fsl_lpuart.c3
-rw-r--r--drivers/tty/serial/imx.c8
-rw-r--r--drivers/tty/serial/mvebu-uart.c1
-rw-r--r--drivers/tty/tty_io.c11
-rw-r--r--drivers/tty/vt/vt_ioctl.c4
6 files changed, 30 insertions, 7 deletions
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index 24a5f05e769b..e5389591bb4f 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -1054,8 +1054,8 @@ static int poll_wait_key(char *obuf, struct uart_cpm_port *pinfo)
1054 /* Get the address of the host memory buffer. 1054 /* Get the address of the host memory buffer.
1055 */ 1055 */
1056 bdp = pinfo->rx_cur; 1056 bdp = pinfo->rx_cur;
1057 while (bdp->cbd_sc & BD_SC_EMPTY) 1057 if (bdp->cbd_sc & BD_SC_EMPTY)
1058 ; 1058 return NO_POLL_CHAR;
1059 1059
1060 /* If the buffer address is in the CPM DPRAM, don't 1060 /* If the buffer address is in the CPM DPRAM, don't
1061 * convert it. 1061 * convert it.
@@ -1090,7 +1090,11 @@ static int cpm_get_poll_char(struct uart_port *port)
1090 poll_chars = 0; 1090 poll_chars = 0;
1091 } 1091 }
1092 if (poll_chars <= 0) { 1092 if (poll_chars <= 0) {
1093 poll_chars = poll_wait_key(poll_buf, pinfo); 1093 int ret = poll_wait_key(poll_buf, pinfo);
1094
1095 if (ret == NO_POLL_CHAR)
1096 return ret;
1097 poll_chars = ret;
1094 pollp = poll_buf; 1098 pollp = poll_buf;
1095 } 1099 }
1096 poll_chars--; 1100 poll_chars--;
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 51e47a63d61a..3f8d1274fc85 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -979,7 +979,8 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport)
979 struct circ_buf *ring = &sport->rx_ring; 979 struct circ_buf *ring = &sport->rx_ring;
980 int ret, nent; 980 int ret, nent;
981 int bits, baud; 981 int bits, baud;
982 struct tty_struct *tty = tty_port_tty_get(&sport->port.state->port); 982 struct tty_port *port = &sport->port.state->port;
983 struct tty_struct *tty = port->tty;
983 struct ktermios *termios = &tty->termios; 984 struct ktermios *termios = &tty->termios;
984 985
985 baud = tty_get_baud_rate(tty); 986 baud = tty_get_baud_rate(tty);
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 239c0fa2e981..0f67197a3783 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2351,6 +2351,14 @@ static int imx_uart_probe(struct platform_device *pdev)
2351 ret); 2351 ret);
2352 return ret; 2352 return ret;
2353 } 2353 }
2354
2355 ret = devm_request_irq(&pdev->dev, rtsirq, imx_uart_rtsint, 0,
2356 dev_name(&pdev->dev), sport);
2357 if (ret) {
2358 dev_err(&pdev->dev, "failed to request rts irq: %d\n",
2359 ret);
2360 return ret;
2361 }
2354 } else { 2362 } else {
2355 ret = devm_request_irq(&pdev->dev, rxirq, imx_uart_int, 0, 2363 ret = devm_request_irq(&pdev->dev, rxirq, imx_uart_int, 0,
2356 dev_name(&pdev->dev), sport); 2364 dev_name(&pdev->dev), sport);
diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
index d04b5eeea3c6..170e446a2f62 100644
--- a/drivers/tty/serial/mvebu-uart.c
+++ b/drivers/tty/serial/mvebu-uart.c
@@ -511,6 +511,7 @@ static void mvebu_uart_set_termios(struct uart_port *port,
511 termios->c_iflag |= old->c_iflag & ~(INPCK | IGNPAR); 511 termios->c_iflag |= old->c_iflag & ~(INPCK | IGNPAR);
512 termios->c_cflag &= CREAD | CBAUD; 512 termios->c_cflag &= CREAD | CBAUD;
513 termios->c_cflag |= old->c_cflag & ~(CREAD | CBAUD); 513 termios->c_cflag |= old->c_cflag & ~(CREAD | CBAUD);
514 termios->c_cflag |= CS8;
514 } 515 }
515 516
516 spin_unlock_irqrestore(&port->lock, flags); 517 spin_unlock_irqrestore(&port->lock, flags);
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 32bc3e3fe4d3..5e5da9acaf0a 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1255,6 +1255,7 @@ static void tty_driver_remove_tty(struct tty_driver *driver, struct tty_struct *
1255static int tty_reopen(struct tty_struct *tty) 1255static int tty_reopen(struct tty_struct *tty)
1256{ 1256{
1257 struct tty_driver *driver = tty->driver; 1257 struct tty_driver *driver = tty->driver;
1258 int retval;
1258 1259
1259 if (driver->type == TTY_DRIVER_TYPE_PTY && 1260 if (driver->type == TTY_DRIVER_TYPE_PTY &&
1260 driver->subtype == PTY_TYPE_MASTER) 1261 driver->subtype == PTY_TYPE_MASTER)
@@ -1268,10 +1269,14 @@ static int tty_reopen(struct tty_struct *tty)
1268 1269
1269 tty->count++; 1270 tty->count++;
1270 1271
1271 if (!tty->ldisc) 1272 if (tty->ldisc)
1272 return tty_ldisc_reinit(tty, tty->termios.c_line); 1273 return 0;
1273 1274
1274 return 0; 1275 retval = tty_ldisc_reinit(tty, tty->termios.c_line);
1276 if (retval)
1277 tty->count--;
1278
1279 return retval;
1275} 1280}
1276 1281
1277/** 1282/**
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index a78ad10a119b..73cdc0d633dd 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -32,6 +32,8 @@
32#include <asm/io.h> 32#include <asm/io.h>
33#include <linux/uaccess.h> 33#include <linux/uaccess.h>
34 34
35#include <linux/nospec.h>
36
35#include <linux/kbd_kern.h> 37#include <linux/kbd_kern.h>
36#include <linux/vt_kern.h> 38#include <linux/vt_kern.h>
37#include <linux/kbd_diacr.h> 39#include <linux/kbd_diacr.h>
@@ -700,6 +702,8 @@ int vt_ioctl(struct tty_struct *tty,
700 if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES) 702 if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
701 ret = -ENXIO; 703 ret = -ENXIO;
702 else { 704 else {
705 vsa.console = array_index_nospec(vsa.console,
706 MAX_NR_CONSOLES + 1);
703 vsa.console--; 707 vsa.console--;
704 console_lock(); 708 console_lock();
705 ret = vc_allocate(vsa.console); 709 ret = vc_allocate(vsa.console);