Re: [PATCH 0/8] tty/serial: Convert ->set_termios() related callchains to const old ktermios

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

 



On Thu, 18 Aug 2022, Andy Shevchenko wrote:

> On Tue, Aug 16, 2022 at 3:11 PM Ilpo Järvinen
> <ilpo.jarvinen@xxxxxxxxxxxxxxx> wrote:
> >
> > ->set_termios() callchains input old ktermios (mainly used as fallback
> > and feature compares). It is discarded right after returning from the
> > calls and should therefore not be modified by drivers because any such
> > change will get lost (instead, the changes must be applied to the new
> > ktermios). While doing this patchset, I found a few such issues that
> > were fixed earlier.
> >
> > Now enforce old ktermios constness. Another goodie is that "get" named
> > functions in tty_baudrate.c that previously mucked with the old
> > ktermios can no longer have such side-effects. I found out that the
> > ktermios adjustments made were dead-code for all in-tree archs anyway.
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> for all, but patch 3.
> 
> I'm not sure we can blindly use old_termios settings, is there any
> guarantee that old_termios _always_ has a correct baud rate settings?

Old_termios is just the previous termios the port was using. If the 
baudrate in termios was invalid already by then, it's another issue that 
should be fixed (but I cannot see how that could occur assuming the 
validation works).

How could it get wrong baud rate settings if the kernel sets (old_)termios 
(earlier) through these same paths (which validated it)?


-- 
 i.

[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