Re: [PATCH 2/2] usb_serial: only allow sysrq on a console port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> If Jason's patch is necessary () - should this be fixed up for standard
> UARTs too?

I think so yes, although I'd not realised it wasn't protected currently ?
> 
> 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?)

will check

> The above patch would sync the (seemlying duplicated) code between
> drivers/usb/serial/generic.c and include/linux/serial_core.h

There is a lot of near duplicate code like this. That is one reason for
adding struct tty_port. In theory both could be collapsed into

	int tty_port_handle_sysrq(struct tty_port *port, unsigned int ch)
	{
	}

at this point as both USB and serial layer UARTs now have a port object.
That would just need port->sysrq collapsing into the tty_port.
port->console sort of already is.

> 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;

That also looks wrong - tty_port_tty_get takes a tty kref. I will check
that Monday and look at collapsing these int one as you note.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux