提交 252f7119 编写于 作者: J Johan Hovold 提交者: Zheng Zengkai

USB: cdc-acm: fix unprivileged TIOCCSERIAL

stable inclusion
from stable-5.10.37
commit 4425c2f32ac9fc7d3699084134a55672361d2fc3
bugzilla: 51868
CVE: NA

--------------------------------

[ Upstream commit dd561958 ]

TIOCSSERIAL is a horrid, underspecified, legacy interface which for most
serial devices is only useful for setting the close_delay and
closing_wait parameters.

A non-privileged user has only ever been able to set the since long
deprecated ASYNC_SPD flags and trying to change any other *supported*
feature should result in -EPERM being returned. Setting the current
values for any supported features should return success.

Fix the cdc-acm implementation which instead indicated that the
TIOCSSERIAL ioctl was not even implemented when a non-privileged user
set the current values.

Fixes: ba2d8ce9 ("cdc-acm: implement TIOCSSERIAL to avoid blocking close(2)")
Acked-by: NOliver Neukum <oneukum@suse.com>
Signed-off-by: NJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210408131602.27956-3-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 a069dc42
...@@ -955,8 +955,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) ...@@ -955,8 +955,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
if ((close_delay != acm->port.close_delay) || if ((close_delay != acm->port.close_delay) ||
(closing_wait != acm->port.closing_wait)) (closing_wait != acm->port.closing_wait))
retval = -EPERM; retval = -EPERM;
else
retval = -EOPNOTSUPP;
} else { } else {
acm->port.close_delay = close_delay; acm->port.close_delay = close_delay;
acm->port.closing_wait = closing_wait; acm->port.closing_wait = closing_wait;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册