All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jianlin Shi <shijianlin11@foxmail.com>
Cc: netdev@vger.kernel.org, virtualization@lists.linux.dev,
	jasowang@redhat.com, eperezma@redhat.com,
	xuanzhuo@linux.alibaba.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, talgi@nvidia.com, hengqi@linux.alibaba.com,
	horms@kernel.org
Subject: Re: [PATCH v2 2/2] virtio-net: unwind VQs when irq moderation init fails
Date: Sun, 22 Nov 2026 16:50:17 -0500	[thread overview]
Message-ID: <20261122165011-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20261102155145.23144-3-shijianlin11@foxmail.com>

On Mon, Nov 02, 2026 at 11:51:45PM +0800, Jianlin Shi wrote:
> virtnet_probe() calls init_vqs() before virtnet_init_irq_moder().
> When the irq moderation init fails, the error path does "goto
> free", which only reaches free_netdev(): virtio_reset_device() and
> virtnet_del_vqs() are skipped, leaking the virtqueues and their
> DMA mappings.
> 
> Use the existing free_irq_moder label instead, as
> virtnet_create_page_pools() already does on failure.  This is safe
> only after net_dim_init_irq_moder() clears dev->irq_moder on its
> own failure (previous patch); otherwise virtnet_free_irq_moder()
> would net_dim_free_irq_moder() a dangling pointer, dereferencing
> freed memory and freeing it a second time.
> 
> Fixes: dcb67f6a9ead6 ("virtio-net: support dim profile fine-tuning")
> Signed-off-by: Jianlin Shi <shijianlin11@foxmail.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/net/virtio_net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index dd2c41ef6fbe..d3ad1f1334bb 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -7027,7 +7027,7 @@ static int virtnet_probe(struct virtio_device *vdev)
>  
>  		err = virtnet_init_irq_moder(vi);
>  		if (err)
> -			goto free;
> +			goto free_irq_moder;
>  	}
>  
>  	/* Create page pools for receive queues.
> -- 
> 2.43.0


  reply	other threads:[~2026-11-22 21:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  8:19 [PATCH 0/2] virtio-net/dim: fix irq moderation init failure unwind Jianlin Shi
2026-09-30  8:19 ` [PATCH 1/2] dim: clear irq_moder on init failure Jianlin Shi
2026-09-30  8:33   ` sashiko-bot
2026-10-06  1:53   ` Jakub Kicinski
2026-10-08 15:42     ` Jianlin Shi
2026-09-30  8:19 ` [PATCH 2/2] virtio-net: unwind VQs when irq moderation init fails Jianlin Shi
2026-09-30  8:33   ` sashiko-bot
2026-11-02 13:46   ` Michael S. Tsirkin
2026-11-02 15:51 ` [PATCH v2 0/2] virtio-net/dim: fix irq moderation init failure unwind Jianlin Shi
2026-11-02 15:51   ` [PATCH v2 1/2] dim: clear irq_moder on init failure Jianlin Shi
2026-11-02 15:51   ` [PATCH v2 2/2] virtio-net: unwind VQs when irq moderation init fails Jianlin Shi
2026-11-22 21:50     ` Michael S. Tsirkin [this message]
2026-11-19 14:45   ` [PATCH v2 0/2] virtio-net/dim: fix irq moderation init failure unwind Michael S. Tsirkin
2026-11-22  9:30     ` Jianlin Shi

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=20261122165011-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=hengqi@linux.alibaba.com \
    --cc=horms@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shijianlin11@foxmail.com \
    --cc=talgi@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.