USB: serial: debug: do not echo input by default
authorMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Mon, 15 Jul 2024 10:44:53 +0000 (12:44 +0200)
committerJohan Hovold <johan@kernel.org>
Wed, 31 Jul 2024 13:13:45 +0000 (15:13 +0200)
commit00af4f3dda1461ec90d892edc10bec6d3c50c554
tree021738d017ed5d89f140f8f72ae847c4807776db
parent8400291e289ee6b2bf9779ff1c83a291501f017b
USB: serial: debug: do not echo input by default

This driver is intended as a "client" end of the console connection.
When connected to a host it's supposed to receive debug logs, and
possibly allow to interact with whatever debug console is available
there. Feeding messages back, depending on a configuration may cause log
messages be executed as shell commands (which can be really bad if one
is unlucky, imagine a log message like "prevented running `rm -rf
/home`"). In case of Xen, it exposes sysrq-like debug interface, and
feeding it its own logs will pretty quickly hit 'R' for "instant
reboot".

Contrary to a classic serial console, the USB one cannot be configured
ahead of time, as the device shows up only when target OS is up. And at
the time device is opened to execute relevant ioctl, it's already too
late, especially when logs start flowing shortly after device is
initialized.
Avoid the issue by changing default to no echo for this type of devices.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
[ johan: amend summary; disable also ECHONL ]
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/usb_debug.c