Files
linux/drivers
Anthony Mallet 8e22289c9f USB: cdc-acm: fix rounding error in TIOCSSERIAL
[ Upstream commit b401f8c4f4 ]

By default, tty_port_init() initializes those parameters to a multiple
of HZ. For instance in line 69 of tty_port.c:
   port->close_delay = (50 * HZ) / 100;
https://github.com/torvalds/linux/blob/master/drivers/tty/tty_port.c#L69

With e.g. CONFIG_HZ = 250 (as this is the case for Ubuntu 18.04
linux-image-4.15.0-37-generic), the default setting for close_delay is
thus 125.

When ioctl(fd, TIOCGSERIAL, &s) is executed, the setting returned in
user space is '12' (125/10). When ioctl(fd, TIOCSSERIAL, &s) is then
executed with the same setting '12', the value is interpreted as '120'
which is different from the current setting and a EPERM error may be
raised by set_serial_info() if !CAP_SYS_ADMIN.
https://github.com/torvalds/linux/blob/master/drivers/usb/class/cdc-acm.c#L919

Fixes: ba2d8ce9db ("cdc-acm: implement TIOCSSERIAL to avoid blocking close(2)")
Signed-off-by: Anthony Mallet <anthony.mallet@laas.fr>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200312133101.7096-2-anthony.mallet@laas.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-02 17:20:27 +02:00
..
2020-04-02 17:20:26 +02:00
2020-01-04 13:39:51 +01:00
2019-05-14 19:19:34 +02:00
2017-09-09 17:39:41 +02:00
2018-12-21 14:11:36 +01:00
2018-11-13 11:17:02 -08:00
2020-03-11 07:53:12 +01:00
2018-10-03 17:01:42 -07:00
2020-02-28 15:42:33 +01:00
2019-05-31 06:48:15 -07:00