lkml.org 
[lkml]   [2011]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix Corruption issue in USB ftdi driver drivers/usb/serial/ftdi_sio.c
> >> +       /* compare old_termios and tty->termios */
> >> + if (old_termios->c_cflag == termios->c_cflag)
> >> + goto no_c_cflag_changes;
> >
> > You can't do it this way because the speed data is not entirely
> > within c_cflag. Check c_ispeed and c_ospeed match and for the
> > parity if you want to skip that check if the parity bits change
> > specifically.
> >
> This is getting into magic flags I don't understand. There are so few
> bits in c_cflag not related to speed and data/parity I am hesitant to
> write a complex check I might well get wrong. But flow control appears
> to be switched off / on frequently during data flow,

It shouldn't be unless the apps you are running are doing odd things.
I'd not expect parity to keep changing certainly. What may be occuring
is that some of these devices only handle RTS/CTS flow and force the
flag on, indicating it back to the app. If the app ignores that then it
may end up trying to clear it several times.

> + if (old_termios->c_cflag == termios->c_cflag
> + && old_termios->c_ispeed == termios->c_ispeed
> + && old_termios->c_ospeed == termios->c_ospeed
> + )
> + goto no_c_cflag_changes;

That is safe enough

> +
> /* NOTE These routines can get interrupted by
> ftdi_sio_read_bulk_callback - need to examine what this
> means - don't see any problems yet */
>
> + if ((old_termios->c_cflag & (CSIZE|PARODD|CSTOPB|PARODD)) ==
> + (termios->c_cflag & (CSIZE|PARODD|CSTOPB|PARODD)))

I think you need

CSIZE (for CS7/8 switch)
PARODD (parity odd/even)
CMSPAR (parity mark/space v odd/even)
CSTOPB (stop bits)

while you have PARODD twice.

Otherwise this looks correct.

Alan



\
 
 \ /
  Last update: 2011-11-02 12:23    [W:0.082 / U:0.628 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site