mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
USB: serial: ti_usb_3410_5052: fix TIOCSSERIAL permission check
commit d370c90dcd upstream.
Changing the port closing-wait parameter is a privileged operation so
make sure to return -EPERM if a regular user tries to change it.
Cc: stable@vger.kernel.org
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
767e8241dd
commit
eb3a757e0b
@@ -1420,14 +1420,19 @@ static int ti_set_serial_info(struct tty_struct *tty,
|
||||
struct serial_struct *ss)
|
||||
{
|
||||
struct usb_serial_port *port = tty->driver_data;
|
||||
struct ti_port *tport = usb_get_serial_port_data(port);
|
||||
struct tty_port *tport = &port->port;
|
||||
unsigned cwait;
|
||||
|
||||
cwait = ss->closing_wait;
|
||||
if (cwait != ASYNC_CLOSING_WAIT_NONE)
|
||||
cwait = msecs_to_jiffies(10 * ss->closing_wait);
|
||||
|
||||
tport->tp_port->port.closing_wait = cwait;
|
||||
if (!capable(CAP_SYS_ADMIN)) {
|
||||
if (cwait != tport->closing_wait)
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
tport->closing_wait = cwait;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user