[PATCH] net: macb: Fix race caused by flushing unwanted descriptors

Tom Rini trini at konsulko.com
Mon Nov 28 20:52:51 CET 2022


On Thu, Nov 10, 2022 at 07:31:34PM +0200, Yaron Micher wrote:

> 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 at hailo.ai>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20221128/72e72e53/attachment.sig>


More information about the U-Boot mailing list