lkml.org 
[lkml]   [2009]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH 2/2] usb_serial: only allow sysrq on a console port
Date
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;
}


\
 
 \ /
  Last update: 2009-07-05 18:55    [W:0.070 / U:3.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site