diff options
author | Daniel Jurgens <danielj@nvidia.com> | 2024-05-15 18:31:25 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-05-17 04:37:41 +0200 |
commit | fa033def4171d2e4e29d5e3714fb2a5b1fc077e8 (patch) | |
tree | acec73d23b4989f3f422e5e0a8f36e54f9642016 | |
parent | netrom: fix possible dead-lock in nr_rt_ioctl() (diff) | |
download | linux-fa033def4171d2e4e29d5e3714fb2a5b1fc077e8.tar.xz linux-fa033def4171d2e4e29d5e3714fb2a5b1fc077e8.zip |
virtio_net: Fix missed rtnl_unlock
The rtnl_lock would stay locked if allocating promisc_allmulti failed.
Also changed the allocation to GFP_KERNEL.
Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
Reported-by: Eric Dumazet <edumaset@google.com>
Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20240515163125.569743-1-danielj@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r-- | drivers/net/virtio_net.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 19a9b50646c7..4e1a0fc0d555 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2902,14 +2902,14 @@ static void virtnet_rx_mode_work(struct work_struct *work) if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX)) return; - rtnl_lock(); - - promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_ATOMIC); + promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_KERNEL); if (!promisc_allmulti) { dev_warn(&dev->dev, "Failed to set RX mode, no memory.\n"); return; } + rtnl_lock(); + *promisc_allmulti = !!(dev->flags & IFF_PROMISC); sg_init_one(sg, promisc_allmulti, sizeof(*promisc_allmulti)); |