Messages in this thread Patch in this message | | | From | Robin Getz <> | Subject | Re: [PATCH 2/2] usb_serial: only allow sysrq on a console port | Date | Sun, 5 Jul 2009 12:54:41 -0400 |
| |
On Mon 1 Jun 2009 09:35, Alan Cox pondered: > On Fri, 29 May 2009 13:34:17 -0500 > Jason Wessel <jason.wessel@windriver.com> wrote: > > > 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. > > This doesn't seem to match any tree I can find ?
Alan:
If Jason's patch is necessary () - should this be fixed up for standard UARTs too?
Make sure that only serial console (not _any_ serial port) responds to sysrq (or should something else be ensuring that this isn't set when the port !console? (I didn't see anything in serial_core.c?)
---
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 23d2fb0..f8ab858 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -474,7 +474,7 @@ static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) { #ifdef SUPPORT_SYSRQ - if (port->sysrq) { + if (port->sysrq && port->console) { if (ch && time_before(jiffies, port->sysrq)) { handle_sysrq(ch, port->info->port.tty); port->sysrq = 0; ---------- That brings up the next question...
The above patch would sync the (seemlying duplicated) code between drivers/usb/serial/generic.c and include/linux/serial_core.h
Greg?
drivers/usb/serial/generic.c int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) { if (port->sysrq && port->console) { if (ch && time_before(jiffies, port->sysrq)) { handle_sysrq(ch, tty_port_tty_get(&port->port)); port->sysrq = 0; return 1; } port->sysrq = 0; } return 0; } include/linux/serial_core.h static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) { #ifdef SUPPORT_SYSRQ if (port->sysrq) { if (ch && time_before(jiffies, port->sysrq)) { handle_sysrq(ch, port->info->port.tty); port->sysrq = 0; return 1; } port->sysrq = 0; } #endif return 0; }
| |