forked from Minki/linux
tty: mxser: fix TIOCSSERIAL permission check
Changing the port type and closing_wait parameter are privileged operations so make sure to return -EPERM if a regular user tries to change them. Note that the closing_wait parameter would not actually have been changed but the return value did not indicate that. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20210407102334.32361-15-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
be6cf583d2
commit
b91cfb2573
@ -1270,6 +1270,7 @@ static int mxser_set_serial_info(struct tty_struct *tty,
|
||||
if (!capable(CAP_SYS_ADMIN)) {
|
||||
if ((ss->baud_base != info->baud_base) ||
|
||||
(close_delay != info->port.close_delay) ||
|
||||
(closing_wait != info->port.closing_wait) ||
|
||||
((ss->flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK))) {
|
||||
mutex_unlock(&port->mutex);
|
||||
return -EPERM;
|
||||
@ -1296,12 +1297,12 @@ static int mxser_set_serial_info(struct tty_struct *tty,
|
||||
baud = ss->baud_base / ss->custom_divisor;
|
||||
tty_encode_baud_rate(tty, baud, baud);
|
||||
}
|
||||
|
||||
info->type = ss->type;
|
||||
|
||||
process_txrx_fifo(info);
|
||||
}
|
||||
|
||||
info->type = ss->type;
|
||||
|
||||
process_txrx_fifo(info);
|
||||
|
||||
if (tty_port_initialized(port)) {
|
||||
if (flags != (port->flags & ASYNC_SPD_MASK)) {
|
||||
spin_lock_irqsave(&info->slock, sl_flags);
|
||||
|
Loading…
Reference in New Issue
Block a user