[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5088d3c2-210a-42eb-a4f4-5c1817f88832@amd.com>
Date: Wed, 15 May 2024 09:35:50 -0700
From: Brett Creeley <bcreeley@....com>
To: Daniel Jurgens <danielj@...dia.com>, netdev@...r.kernel.org
Cc: mst@...hat.com, jasowang@...hat.com, xuanzhuo@...ux.alibaba.com,
virtualization@...ts.linux.dev, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, jiri@...dia.com,
Eric Dumazet <edumaset@...gle.com>
Subject: Re: [PATCH v3] virtio_net: Fix missed rtnl_unlock
On 5/15/2024 9:31 AM, Daniel Jurgens wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> 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@...gle.com>
> Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
> Signed-off-by: Daniel Jurgens <danielj@...dia.com>
> ---
> v3:
> - Changed to promisc_allmulti alloc to GPF_KERNEL
> v2:
> - Added fixes tag.
> ---
> drivers/net/virtio_net.c | 6 +++---
> 1 file 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));
>
> --
> 2.45.0
Reviewed-by: Brett Creeley <brett.creeley@....com>
Powered by blists - more mailing lists