Re: [PATCH] Fix Corruption issue in USB ftdi driver drivers/usb/serial/ftdi_sio.c

From: Uwe Bonnes
Date: Fri Oct 28 2011 - 06:51:03 EST


>>>>> "Andrew" == Andrew Worsley <amworsley@xxxxxxxxx> writes:

Andrew> ftdi_set_termios() is always setting the baud rate and data bits
Andrew> and parity on every call. When called while characters are being
Andrew> transmitted can cause the FTDI chip to corrupt the serial port
Andrew> bit stream by stalling the output half a bit during the output
Andrew> of a character. Simple fix by skipping this setting if the baud
Andrew> rate/data bits/parity are unchanged.

Andrew> Signed-off-by: Andrew Worsley <amworsley@xxxxxxxxx> ----

Andrew> This bug was observed on 2.6.32 kernel (this patch is ported to
Andrew> latest kernel for ease of review). Using a FTDI USB serial chip
Andrew> at 38400 repeatedly generating output by running a simple
Andrew> command such as "uname -a" or "echo Linux" gives occasional
Andrew> corruption on the output

Andrew> ...
>> echo Linux
Andrew> L$,3u=(Bnux

Could you please give a more specific receipe to reproduce the bug. Running
with an adapter with TX/RX shorted at "stty -F /dev/ttyUSB0" 38400", several
> uname -a /dev/ttyUSB0
runs gave no artifact in a "seyon -modem /dev/ttyUSB0" console.

Doing
> uname -a /dev/ttyUSB0
in one xterm and receiving with
>cat /dev/ttyUSB0
in another xterm gives lot of repeated lines in the receiving terminal. But
I have the same behaviour with /dev/ttyS0 on a real serial port on the
mainboard.

Otherwise, shouldn't all control transfers to the FTDI be only done with the
tx buffer in the FTDI empty? I guess the RX buffer is not affected by some
change. But this is something to be done with great knowledge...

Bye
--
Uwe Bonnes bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/