Skip to content

virtio-net/dim: fix irq moderation init failure unwind

Jianlin Shi netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyIn review
  2. v22 patches 3 repliesSuperseded
  3. v12 patches 3 repliesSuperseded

Changes in v3 from the cover letter

- Resend as a new thread with a [PATCH net] subject prefix, as requested by Michael S. Tsirkin.
- No functional changes. Both patches are identical to v2.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2dim: clear irq_moder on init failurelib/dim/net_dim.c+1 -00 replies
2/2virtio-net: unwind VQs when irq moderation init failsdrivers/net/virtio_net.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH net v3 0/2] virtio-net/dim: fix irq moderation init failure unwind

net_dim_init_irq_moder() leaves dev->irq_moder dangling when profile allocation fails. virtio-net probe then skips the virtqueue teardown if that init fails after init_vqs(), leaking the virtqueues and their DMA mappings.

Patch 1 makes the dim init failure path clear dev->irq_moder, so net_dim_free_irq_moder() is a no-op afterwards. Patch 2 sends the virtio-net failure through the existing free_irq_moder unwind (reset + del_vqs), matching the page-pool failure path. Patch 2 depends on patch 1.

Changes since v2:

- Resend as a new thread with a [PATCH net] subject prefix, as requested by Michael S. Tsirkin.
- No functional changes. Both patches are identical to v2.

Changes since v1 [1]:

- Patch 1's commit message now documents the call sequence the maintainer asked for: on current mainline the dangling pointer is never dereferenced by the only in-tree caller (virtio-net probe does "goto free", which only reaches free_netdev()). It becomes reachable once the caller unwinds through free_irq_moder as patch 2 does, which makes patch 1 a hard prerequisite rather than a standalone bug fix.

- No functional changes; both patches are identical to v1.

[1] https://lore.kernel.org/netdev/[email protected]/

Jianlin Shi (2):
dim: clear irq_moder on init failure
virtio-net: unwind VQs when irq moderation init fails

 drivers/net/virtio_net.c | 2 +-
 lib/dim/net_dim.c        | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0