Commit 5a0455c4 authored by Russell King's avatar Russell King Committed by Linus Torvalds

[SERIAL] Four bug fixes

- Preserve per-port flags which are not modifyable from user space.
- Only allow DTR, RTS, OUT1 and OUT2 to be controlled from user space.
- Don't put the console port into sleep mode when closing a port.
- Ensure that we wake up people waiting on modem status changes when
  we receive a hangup.
parent b831d0fc
...@@ -805,7 +805,8 @@ uart_set_info(struct uart_state *state, struct serial_struct *newinfo) ...@@ -805,7 +805,8 @@ uart_set_info(struct uart_state *state, struct serial_struct *newinfo)
port->irq = new_serial.irq; port->irq = new_serial.irq;
port->uartclk = new_serial.baud_base * 16; port->uartclk = new_serial.baud_base * 16;
port->flags = new_serial.flags & UPF_CHANGE_MASK; port->flags = (port->flags & ~UPF_CHANGE_MASK) |
(new_serial.flags & UPF_CHANGE_MASK);
port->custom_divisor = new_serial.custom_divisor; port->custom_divisor = new_serial.custom_divisor;
state->close_delay = new_serial.close_delay * HZ / 100; state->close_delay = new_serial.close_delay * HZ / 100;
state->closing_wait = new_serial.closing_wait * HZ / 100; state->closing_wait = new_serial.closing_wait * HZ / 100;
...@@ -883,6 +884,8 @@ uart_set_modem_info(struct uart_port *port, unsigned int cmd, ...@@ -883,6 +884,8 @@ uart_set_modem_info(struct uart_port *port, unsigned int cmd,
if (get_user(arg, value)) if (get_user(arg, value))
return -EFAULT; return -EFAULT;
arg &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2;
set = clear = 0; set = clear = 0;
switch (cmd) { switch (cmd) {
case TIOCMBIS: case TIOCMBIS:
...@@ -1279,7 +1282,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) ...@@ -1279,7 +1282,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
schedule_timeout(state->close_delay); schedule_timeout(state->close_delay);
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
} }
} else { } else if (!port->cons || port->cons->index != port->line) {
if (port->ops->pm) if (port->ops->pm)
port->ops->pm(port, 3, 0); port->ops->pm(port, 3, 0);
} }
...@@ -1374,6 +1377,7 @@ static void uart_hangup(struct tty_struct *tty) ...@@ -1374,6 +1377,7 @@ static void uart_hangup(struct tty_struct *tty)
state->info->flags &= ~UIF_NORMAL_ACTIVE; state->info->flags &= ~UIF_NORMAL_ACTIVE;
state->info->tty = NULL; state->info->tty = NULL;
wake_up_interruptible(&state->info->open_wait); wake_up_interruptible(&state->info->open_wait);
wake_up_interruptible(&state->info->delta_msr_wait);
} }
up(&state->sem); up(&state->sem);
} }
......
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