virtio_net: avoid data-races on dev->stats fields
authorEric Dumazet <edumazet@google.com>
Thu, 21 Sep 2023 08:52:17 +0000 (08:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Jan 2024 16:16:52 +0000 (17:16 +0100)
commite2e5c2a3f90f57f097129b13efe823b8dd32a40c
treeaf1711c32d098a56a8cacc6356180776ed1b7405
parent6d2e4e56576f37e8edbb4032778403a6423d99b6
virtio_net: avoid data-races on dev->stats fields

[ Upstream commit d12a26b74fb77434b73fe39022266c4b00907219 ]

Use DEV_STATS_INC() and DEV_STATS_READ() which provide
atomicity on paths that can be used concurrently.

Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: 2311e06b9bf3 ("virtio_net: fix missing dma unmap for resize")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/virtio_net.c