Commit 45a4c079 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull tty/serial fixes from Greg KH:
 "Here are some tiny serial/tty fixes for 3.18-rc4 that resolve some
  reported issues"

* tag 'tty-3.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: Fix pty master poll() after slave closes v2
  serial: of-serial: fix uninitialized kmalloc variable
  tty/vt: don't set font mappings on vc not supporting this
  tty: serial: 8250_mtk: Fix quot calculation
  tty: Prevent "read/write wait queue active!" log flooding
  tty: Fix high cpu load if tty is unreleaseable
  serial: Fix divide-by-zero fault in uart_get_divisor()
parents b9427910 c4dc3046
...@@ -2413,12 +2413,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, ...@@ -2413,12 +2413,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file,
poll_wait(file, &tty->read_wait, wait); poll_wait(file, &tty->read_wait, wait);
poll_wait(file, &tty->write_wait, wait); poll_wait(file, &tty->write_wait, wait);
if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
mask |= POLLHUP;
if (input_available_p(tty, 1))
mask |= POLLIN | POLLRDNORM;
else if (mask & POLLHUP) {
tty_flush_to_ldisc(tty);
if (input_available_p(tty, 1)) if (input_available_p(tty, 1))
mask |= POLLIN | POLLRDNORM; mask |= POLLIN | POLLRDNORM;
}
if (tty->packet && tty->link->ctrl_status) if (tty->packet && tty->link->ctrl_status)
mask |= POLLPRI | POLLIN | POLLRDNORM; mask |= POLLPRI | POLLIN | POLLRDNORM;
if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
mask |= POLLHUP;
if (tty_hung_up_p(file)) if (tty_hung_up_p(file))
mask |= POLLHUP; mask |= POLLHUP;
if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) {
......
...@@ -81,7 +81,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -81,7 +81,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
/* Set to highest baudrate supported */ /* Set to highest baudrate supported */
if (baud >= 1152000) if (baud >= 1152000)
baud = 921600; baud = 921600;
quot = DIV_ROUND_CLOSEST(port->uartclk, 256 * baud); quot = (port->uartclk / (256 * baud)) + 1;
} }
/* /*
......
...@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev) ...@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
return -EBUSY; return -EBUSY;
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kzalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) if (info == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -363,7 +363,7 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, ...@@ -363,7 +363,7 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
* The spd_hi, spd_vhi, spd_shi, spd_warp kludge... * The spd_hi, spd_vhi, spd_shi, spd_warp kludge...
* Die! Die! Die! * Die! Die! Die!
*/ */
if (baud == 38400) if (try == 0 && baud == 38400)
baud = altbaud; baud = altbaud;
/* /*
......
...@@ -1709,6 +1709,8 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1709,6 +1709,8 @@ int tty_release(struct inode *inode, struct file *filp)
int pty_master, tty_closing, o_tty_closing, do_sleep; int pty_master, tty_closing, o_tty_closing, do_sleep;
int idx; int idx;
char buf[64]; char buf[64];
long timeout = 0;
int once = 1;
if (tty_paranoia_check(tty, inode, __func__)) if (tty_paranoia_check(tty, inode, __func__))
return 0; return 0;
...@@ -1789,11 +1791,18 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1789,11 +1791,18 @@ int tty_release(struct inode *inode, struct file *filp)
if (!do_sleep) if (!do_sleep)
break; break;
if (once) {
once = 0;
printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", printk(KERN_WARNING "%s: %s: read/write wait queue active!\n",
__func__, tty_name(tty, buf)); __func__, tty_name(tty, buf));
}
tty_unlock_pair(tty, o_tty); tty_unlock_pair(tty, o_tty);
mutex_unlock(&tty_mutex); mutex_unlock(&tty_mutex);
schedule(); schedule_timeout_killable(timeout);
if (timeout < 120 * HZ)
timeout = 2 * timeout + 1;
else
timeout = MAX_SCHEDULE_TIMEOUT;
} }
/* /*
......
...@@ -540,6 +540,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) ...@@ -540,6 +540,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
/* Save original vc_unipagdir_loc in case we allocate a new one */ /* Save original vc_unipagdir_loc in case we allocate a new one */
p = *vc->vc_uni_pagedir_loc; p = *vc->vc_uni_pagedir_loc;
if (!p) {
err = -EINVAL;
goto out_unlock;
}
if (p->refcount > 1) { if (p->refcount > 1) {
int j, k; int j, k;
u16 **p1, *p2, l; u16 **p1, *p2, l;
...@@ -623,6 +629,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) ...@@ -623,6 +629,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
set_inverse_transl(vc, p, i); /* Update inverse translations */ set_inverse_transl(vc, p, i); /* Update inverse translations */
set_inverse_trans_unicode(vc, p); set_inverse_trans_unicode(vc, p);
out_unlock:
console_unlock(); console_unlock();
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment