Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit be43d20

Browse files
jhovoldgregkh
authored andcommitted
USB: serial: ti_usb_3410_5052: fix TIOCSSERIAL permission check
commit d370c90 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>
1 parent 2ab7525 commit be43d20

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/usb/serial/ti_usb_3410_5052.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,14 +1418,19 @@ static int ti_set_serial_info(struct tty_struct *tty,
14181418
struct serial_struct *ss)
14191419
{
14201420
struct usb_serial_port *port = tty->driver_data;
1421-
struct ti_port *tport = usb_get_serial_port_data(port);
1421+
struct tty_port *tport = &port->port;
14221422
unsigned cwait;
14231423

14241424
cwait = ss->closing_wait;
14251425
if (cwait != ASYNC_CLOSING_WAIT_NONE)
14261426
cwait = msecs_to_jiffies(10 * ss->closing_wait);
14271427

1428-
tport->tp_port->port.closing_wait = cwait;
1428+
if (!capable(CAP_SYS_ADMIN)) {
1429+
if (cwait != tport->closing_wait)
1430+
return -EPERM;
1431+
}
1432+
1433+
tport->closing_wait = cwait;
14291434

14301435
return 0;
14311436
}

0 commit comments

Comments
 (0)