
On Fri 2021-02-05 20:12:01, Pali Rohár wrote:
This patch fixes configuring FIFO for one-directional endpoints which have either RX or TX queue and therefore only one FIFO.
Size of FIFO buffer is 2^(idx+3) bytes and starting address is 2^(addr+3). Moreover first 64 bytes are reserved for EP0.
Without this patch if FIFO size specified by caller was zero then idx was incorrectly calculated (expr. ffs(0)-1) and size overflowed in fifosz register. This register uses has only 4 bits for FIFO size. Moreover specifying zero size is not possible.
This patch is fixing calculation of start address and buffer size to minimal value and ensure that it would not overlap with reserved EP0 buffer.
This issue caused loose of packets on USB bus in both directions and basically usbtty was unusable.
Signed-off-by: Pali Rohár pali@kernel.org
1-5: Acked-by: Pavel Machek pavel@ucw.cz