]> www.infradead.org Git - users/dwmw2/linux.git/commit
net: renesas: rswitch: fix race window between tx start and complete
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>
Sun, 8 Dec 2024 09:50:02 +0000 (14:50 +0500)
committerJakub Kicinski <kuba@kernel.org>
Wed, 11 Dec 2024 03:02:47 +0000 (19:02 -0800)
commit0c9547e6ccf40455b0574cf589be3b152a3edf5b
tree4176e47e1cd03d3ee3e7ab0c143d4df916aa61c7
parent5cb099902b6b6292b3a85ffa1bb844e0ba195945
net: renesas: rswitch: fix race window between tx start and complete

If hardware is already transmitting, it can start handling the
descriptor being written to immediately after it observes updated DT
field, before the queue is kicked by a write to GWTRC.

If the start_xmit() execution is preempted at unfortunate moment, this
transmission can complete, and interrupt handled, before gq->cur gets
updated. With the current implementation of completion, this will cause
the last entry not completed.

Fix that by changing completion loop to check DT values directly, instead
of depending on gq->cur.

Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://patch.msgid.link/20241208095004.69468-3-nikita.yoush@cogentembedded.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/renesas/rswitch.c