diff options
author | Yaron Micher | 2022-11-10 19:31:34 +0200 |
---|---|---|
committer | Tom Rini | 2022-11-28 13:06:40 -0500 |
commit | d1559435d7f03517c7306e1c43e2ef497479f34b (patch) | |
tree | 6f82c3650790b832de8f918ad25a0c2ee40424b2 /drivers/net/phy/lxt.c | |
parent | d6abc7e2e027956eb0b5e73bb2be5cf995b15ae6 (diff) |
net: macb: Fix race caused by flushing unwanted descriptors
The rx descriptor list is in cached memory, and there may be multiple
descriptors per cache-line. After reclaim_rx_buffers marks a descriptor
as unused it does a cache flush, which causes the entire cache-line to
be written to memory, which may override other descriptors in the same
cache-line that the controller may have written to.
The fix skips freeing descriptors that are not the last in a cache-line,
and if the freed descriptor is the last one in a cache-line, it marks
all the descriptors in the cache-line as unused.
This is similarly to what is done in drivers/net/fec_mxc.c
In my case this bug caused tftpboot to fail some times when other
packets are sent to u-boot in addition to the ongoing tftp (e.g. ping).
The driver would stop receiving new packets because it is waiting
on a descriptor that is marked unused, when in reality the descriptor
contains a new unprocessed packet but while freeing the previous buffer
descriptor & flushing the cache, the driver accidentally marked the
descriptor as unused.
Signed-off-by: Yaron Micher <yaronm@hailo.ai>
Diffstat (limited to 'drivers/net/phy/lxt.c')
0 files changed, 0 insertions, 0 deletions