Commit 568d422e authored by Jason Wessel's avatar Jason Wessel Committed by Greg Kroah-Hartman

USB: usb_serial: only allow sysrq on a console port

The only time a sysrq should get processed is if the attached device
is a console.  This is intended to protect sysrq execution on a host
connected with a terminal program.

Here is the problem scenario:

host A <-- rs232 link --> host B

Host A is using mincom and a usb pl2303 device to connect to host b
which is a linux system with a usb pl2303 device acting as the serial
console.  When host B is rebooted the pl2303 emits random junk
characters on reset.  These character sequences contain serial break
signals most of the time and when translated to a sysrq have caused
host A to get random processes killed, reboots or power down.

It is true that in this setup with this patch host B might still have
the same problem as host A if you reboot host A.  In most cases host A
is a development host which seldom gets rebooted, and you could turn
off sysrq temporarily on host B if you need to reboot host A.
Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 430eb0d2
...@@ -528,7 +528,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty) ...@@ -528,7 +528,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
{ {
if (port->sysrq) { if (port->sysrq && port->console) {
if (ch && time_before(jiffies, port->sysrq)) { if (ch && time_before(jiffies, port->sysrq)) {
handle_sysrq(ch, tty_port_tty_get(&port->port)); handle_sysrq(ch, tty_port_tty_get(&port->port));
port->sysrq = 0; port->sysrq = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment