Virtualization Archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Daniel Jurgens <danielj@nvidia.com>
Cc: netdev@vger.kernel.org, mst@redhat.com, jasowang@redhat.com,
	 xuanzhuo@linux.alibaba.com, virtualization@lists.linux.dev,
	 davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	jiri@nvidia.com,  Eric Dumazet <edumaset@google.com>
Subject: Re: [PATCH v2] virtio_net: Fix missed rtnl_unlock
Date: Wed, 15 May 2024 17:27:44 +0200	[thread overview]
Message-ID: <CANn89iJmr9ZtfT0jp5kcLC9BKha_QM2U0CpgeuaztMEo4nX64A@mail.gmail.com> (raw)
In-Reply-To: <20240515151152.564085-1-danielj@nvidia.com>

On Wed, May 15, 2024 at 5:12 PM Daniel Jurgens <danielj@nvidia.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@google.com>
> Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.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
>

      reply	other threads:[~2024-05-15 15:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15 15:11 [PATCH v2] virtio_net: Fix missed rtnl_unlock Daniel Jurgens
2024-05-15 15:27 ` Eric Dumazet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANn89iJmr9ZtfT0jp5kcLC9BKha_QM2U0CpgeuaztMEo4nX64A@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=danielj@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumaset@google.com \
    --cc=jasowang@redhat.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).