aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-06 12:02:58 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-06 12:02:58 -0500
commit3caad34eab57e622dad48086af7f89c19001664e (patch)
treea48bde0d80cf67d419aaf428222de73ef2a9d814
parent0472bf06c6fd33c1a18aaead4c8f91e5a03d8d7b (diff)
parentf51ccf46217c28758b1f3b5bc0ccfc00eca658b2 (diff)
Merge tag 'usb-serial-4.20-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus
Johan writes: USB-serial fix for v4.20-rc6 Here's a fix for a reported USB-console regression in 4.18 which revealed a long-standing bug in the console implementation. The patch has been in linux-next over night with no reported issues. Signed-off-by: Johan Hovold <johan@kernel.org> * tag 'usb-serial-4.20-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial: USB: serial: console: fix reported terminal settings
-rw-r--r--drivers/tty/tty_io.c11
-rw-r--r--drivers/usb/serial/console.c2
-rw-r--r--include/linux/tty.h1
3 files changed, 11 insertions, 3 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index ee80dfbd5442..687250ec8032 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1373,7 +1373,13 @@ err_release_lock:
1373 return ERR_PTR(retval); 1373 return ERR_PTR(retval);
1374} 1374}
1375 1375
1376static void tty_free_termios(struct tty_struct *tty) 1376/**
1377 * tty_save_termios() - save tty termios data in driver table
1378 * @tty: tty whose termios data to save
1379 *
1380 * Locking: Caller guarantees serialisation with tty_init_termios().
1381 */
1382void tty_save_termios(struct tty_struct *tty)
1377{ 1383{
1378 struct ktermios *tp; 1384 struct ktermios *tp;
1379 int idx = tty->index; 1385 int idx = tty->index;
@@ -1392,6 +1398,7 @@ static void tty_free_termios(struct tty_struct *tty)
1392 } 1398 }
1393 *tp = tty->termios; 1399 *tp = tty->termios;
1394} 1400}
1401EXPORT_SYMBOL_GPL(tty_save_termios);
1395 1402
1396/** 1403/**
1397 * tty_flush_works - flush all works of a tty/pty pair 1404 * tty_flush_works - flush all works of a tty/pty pair
@@ -1491,7 +1498,7 @@ static void release_tty(struct tty_struct *tty, int idx)
1491 WARN_ON(!mutex_is_locked(&tty_mutex)); 1498 WARN_ON(!mutex_is_locked(&tty_mutex));
1492 if (tty->ops->shutdown) 1499 if (tty->ops->shutdown)
1493 tty->ops->shutdown(tty); 1500 tty->ops->shutdown(tty);
1494 tty_free_termios(tty); 1501 tty_save_termios(tty);
1495 tty_driver_remove_tty(tty->driver, tty); 1502 tty_driver_remove_tty(tty->driver, tty);
1496 tty->port->itty = NULL; 1503 tty->port->itty = NULL;
1497 if (tty->link) 1504 if (tty->link)
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 17940589c647..7d289302ff6c 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -101,7 +101,6 @@ static int usb_console_setup(struct console *co, char *options)
101 cflag |= PARENB; 101 cflag |= PARENB;
102 break; 102 break;
103 } 103 }
104 co->cflag = cflag;
105 104
106 /* 105 /*
107 * no need to check the index here: if the index is wrong, console 106 * no need to check the index here: if the index is wrong, console
@@ -164,6 +163,7 @@ static int usb_console_setup(struct console *co, char *options)
164 serial->type->set_termios(tty, port, &dummy); 163 serial->type->set_termios(tty, port, &dummy);
165 164
166 tty_port_tty_set(&port->port, NULL); 165 tty_port_tty_set(&port->port, NULL);
166 tty_save_termios(tty);
167 tty_kref_put(tty); 167 tty_kref_put(tty);
168 } 168 }
169 tty_port_set_initialized(&port->port, 1); 169 tty_port_set_initialized(&port->port, 1);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 414db2bce715..392138fe59b6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -556,6 +556,7 @@ extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
556extern void tty_release_struct(struct tty_struct *tty, int idx); 556extern void tty_release_struct(struct tty_struct *tty, int idx);
557extern int tty_release(struct inode *inode, struct file *filp); 557extern int tty_release(struct inode *inode, struct file *filp);
558extern void tty_init_termios(struct tty_struct *tty); 558extern void tty_init_termios(struct tty_struct *tty);
559extern void tty_save_termios(struct tty_struct *tty);
559extern int tty_standard_install(struct tty_driver *driver, 560extern int tty_standard_install(struct tty_driver *driver,
560 struct tty_struct *tty); 561 struct tty_struct *tty);
561 562