Commit fa033def authored by Daniel Jurgens's avatar Daniel Jurgens Committed by Jakub Kicinski

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: ff7c7d9f ("virtio_net: Remove command data from control_buf")
Reported-by: default avatarEric Dumazet <edumaset@google.com>
Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/Signed-off-by: default avatarDaniel Jurgens <danielj@nvidia.com>
Reviewed-by: default avatarBrett Creeley <brett.creeley@amd.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20240515163125.569743-1-danielj@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e03e7f20
...@@ -2902,14 +2902,14 @@ static void virtnet_rx_mode_work(struct work_struct *work) ...@@ -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)) if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX))
return; return;
rtnl_lock(); promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_KERNEL);
promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_ATOMIC);
if (!promisc_allmulti) { if (!promisc_allmulti) {
dev_warn(&dev->dev, "Failed to set RX mode, no memory.\n"); dev_warn(&dev->dev, "Failed to set RX mode, no memory.\n");
return; return;
} }
rtnl_lock();
*promisc_allmulti = !!(dev->flags & IFF_PROMISC); *promisc_allmulti = !!(dev->flags & IFF_PROMISC);
sg_init_one(sg, promisc_allmulti, sizeof(*promisc_allmulti)); sg_init_one(sg, promisc_allmulti, sizeof(*promisc_allmulti));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment