Buffer overflow concerns when TTY_THRESHOLD_THROTTLE <= Uart FIFO size of the sending side

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

 



When using software-level RTS/CTS flow control (or Xon/Xoff), we could
leak at most the UART FIFO size of bytes after getting the flow
control signal. This is because the bytes might be loaded in the FIFO
when the flow control signal comes through and the UART will send them
out the wire.

Consider a case where I have a UART with a 128 byte FIFO. The
TTY_THRESHOLD_THROTTLE is set at 128 bytes in n_tty.c. So, isn't it
possible that potentially we lose bytes when moving data to the TTY
line discipline buffer? If the line discipline buffer is almost full
(say the receiving room is 120 bytes), it calls throttle and even if
the other end gets the throttle in time, it could potentially send 128
bytes (but there is only 120 bytes of space in the buffer). So when we
are flushing to ldisc, we will transfer only the receive_room amount
of data and discard the rest? Is there any way of avoiding this?

I know there is no way of knowing what the FIFO size of the other side
might be! I was wondering if this happens, could we potentially flag a
buffer overflow error? We know how many bytes are coming in from the
UART and when we are trying to flush to ldisc, if the count is more
than the throttle level, can we return an error?

Thanks,
Karthik
--
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