virtio_net: move tx vq operation under tx queue lock
authorMichael S. Tsirkin <mst@redhat.com>
Tue, 13 Apr 2021 05:35:26 +0000 (01:35 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:02:21 +0000 (16:02 +0200)
commite2ab2ec59941e3d9d2d49e482b13433ac343d2c1
tree2218776eedd7c94bec60eca70860d49b0c8d3485
parent228e0a05ac884f3298b107230d5c1c248ea93840
virtio_net: move tx vq operation under tx queue lock

[ Upstream commit 5a2f966d0f3fa0ef6dada7ab9eda74cacee96b8a ]

It's unsafe to operate a vq from multiple threads.
Unfortunately this is exactly what we do when invoking
clean tx poll from rx napi.
Same happens with napi-tx even without the
opportunistic cleaning from the receive interrupt: that races
with processing the vq in start_xmit.

As a fix move everything that deals with the vq to under tx lock.

Fixes: b92f1e6751a6 ("virtio-net: transmit napi")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/virtio_net.c