PROBLEM: serial port loopback serious bug

From: Petr Slansky
Date: Wed Apr 21 2004 - 05:01:44 EST


I observe the bug in kernel 2.4.21 and 2.4.22, I guess it is general problem
in 2.4.xx kernel. Command 'cat file >/dev/ttyS0' sends the first 4096 bytes
again and again...


I have generic serial port on i586 machine (PC). I created loopback cable
(TX-RX and RTS-CTS pins connected) and conected the cable to serial port
ttyS0. Simple serial port loopback.

#stty 38400 raw clocal crtscts </dev/ttyS0

Command in console1 (capture ttyS0 to file):
#cat /dev/ttyS0 > fileI.bin

Command in console2 (send a longer file to ttyS0):
#cat fileO.bin >/dev/ttyS0

The file fileO.bin have to be at least 4096 bytes long.

I guess you know what is expected result but I bet you don't know real
result under Linux. I will tell you. Only first 4096 bytes are sent to
/dev/ttyS0. After that this sequence is read from /dev/ttyS0 again and
again..., even when no data are send to /dev/ttyS0 anymore. I tested this
sequence on FreeBSD 4.9 too and I had no problem with loopback like
this there. Something is seriosly wrong in kernel 2.4.x What about 2.6.x??

With regards,

Petr Slansky, slansky@xxxxxxx

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at