Re: Fwd: serial_core.c bug: TIOCSERCONFIG ioctl does not respect UPF_FIXED_TYPE flag

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

 



On Fri, Feb 2, 2018 at 2:57 AM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>> Looking at drivers/tty/serial/serial_core.c it appears TIOCSERCONFIG
>> ioctl does not respect the UPF_FIXED_TYPE flag.  Instead, it calls
>> uart_do_autoconfig which unconditionally passes the UART_CONFIG_TYPE
>> flag to the config_port call.
>
> Can you write up a patch that shows the solution for the issue that you
> think this is causing?

Sure, here is a (completely untested) patch to illustrate.

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index c8dde56b532b..c38eff976117 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1133,7 +1133,9 @@ static int uart_do_autoconfig(struct tty_struct
*tty,struct uart_state *state)
               if (uport->type != PORT_UNKNOWN && uport->ops->release_port)
                       uport->ops->release_port(uport);

-               flags = UART_CONFIG_TYPE;
+               flags = 0;
+               if ((uport->flags & UPF_FIXED_TYPE) == 0)
+                       flags |= UART_CONFIG_TYPE;
               if (uport->flags & UPF_AUTO_IRQ)
                       flags |= UART_CONFIG_IRQ;


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



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux