lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANn89iJmr9ZtfT0jp5kcLC9BKha_QM2U0CpgeuaztMEo4nX64A@mail.gmail.com>
Date: Wed, 15 May 2024 17:27:44 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Daniel Jurgens <danielj@...dia.com>
Cc: netdev@...r.kernel.org, mst@...hat.com, jasowang@...hat.com, 
	xuanzhuo@...ux.alibaba.com, virtualization@...ts.linux.dev, 
	davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com, jiri@...dia.com, 
	Eric Dumazet <edumaset@...gle.com>
Subject: Re: [PATCH v2] virtio_net: Fix missed rtnl_unlock

On Wed, May 15, 2024 at 5:12 PM Daniel Jurgens <danielj@...dia.com> wrote:
>
> The rtnl_lock would stay locked if allocating promisc_allmulti failed.
>
> 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>
> ---
>  drivers/net/virtio_net.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 19a9b50646c7..e2b7488f375e 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);

While we are at this, please change GFP_ATOMIC to GFP_KERNEL here.

>         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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ