]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Aug 2023 05:57:20 +0000 (07:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Aug 2023 05:57:20 +0000 (07:57 +0200)
added patches:
virtio-net-fix-race-between-set-queues-and-probe.patch

queue-5.10/series
queue-5.10/virtio-net-fix-race-between-set-queues-and-probe.patch [new file with mode: 0644]

index d7b50dc77fa849fb1d27db8b123336c8885cdf25..ded087e7878cc835789af7ba4c7c57ec87e5c7c5 100644 (file)
@@ -98,3 +98,4 @@ kvm-vmx-don-t-fudge-cr0-and-cr4-for-restricted-l2-gu.patch
 staging-rtl8712-use-constants-from-linux-ieee80211.h.patch
 staging-r8712-fix-memory-leak-in-_r8712_init_xmit_pr.patch
 btrfs-check-if-the-transaction-was-aborted-at-btrfs_.patch
+virtio-net-fix-race-between-set-queues-and-probe.patch
diff --git a/queue-5.10/virtio-net-fix-race-between-set-queues-and-probe.patch b/queue-5.10/virtio-net-fix-race-between-set-queues-and-probe.patch
new file mode 100644 (file)
index 0000000..090118c
--- /dev/null
@@ -0,0 +1,47 @@
+From 25266128fe16d5632d43ada34c847d7b8daba539 Mon Sep 17 00:00:00 2001
+From: Jason Wang <jasowang@redhat.com>
+Date: Tue, 25 Jul 2023 03:20:49 -0400
+Subject: virtio-net: fix race between set queues and probe
+
+From: Jason Wang <jasowang@redhat.com>
+
+commit 25266128fe16d5632d43ada34c847d7b8daba539 upstream.
+
+A race were found where set_channels could be called after registering
+but before virtnet_set_queues() in virtnet_probe(). Fixing this by
+moving the virtnet_set_queues() before netdevice registering. While at
+it, use _virtnet_set_queues() to avoid holding rtnl as the device is
+not even registered at that time.
+
+Cc: stable@vger.kernel.org
+Fixes: a220871be66f ("virtio-net: correctly enable multiqueue")
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+Acked-by: Michael S. Tsirkin <mst@redhat.com>
+Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
+Link: https://lore.kernel.org/r/20230725072049.617289-1-jasowang@redhat.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/virtio_net.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/virtio_net.c
++++ b/drivers/net/virtio_net.c
+@@ -3220,6 +3220,8 @@ static int virtnet_probe(struct virtio_d
+               }
+       }
++      _virtnet_set_queues(vi, vi->curr_queue_pairs);
++
+       /* serialize netdev register + virtio_device_ready() with ndo_open() */
+       rtnl_lock();
+@@ -3240,8 +3242,6 @@ static int virtnet_probe(struct virtio_d
+               goto free_unregister_netdev;
+       }
+-      virtnet_set_queues(vi, vi->curr_queue_pairs);
+-
+       /* Assume link up if device can't report link status,
+          otherwise get link status from config. */
+       netif_carrier_off(dev);