qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gal Horowitz <galush.horowitz@gmail.com>
To: qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>, Stefan Weil <sw@weilnetz.de>,
	 Gal Horowitz <galush.horowitz@gmail.com>
Subject: [PATCH v4 0/2] tap-win32: fix multiple tap support
Date: Fri, 17 Oct 2025 14:59:01 +0300	[thread overview]
Message-ID: <20251017-fix-win32-multiple-taps-v4-0-483415799ed8@gmail.com> (raw)

Currently when more than one tap is created on Windows, QEMU immediately
crashes with a null-deref since the code incorrectly uses a static global
for the tap state.

Instead, this series allocates a structure for each tap at startup.
We also take care of cleaning up when the tap device is close.

NOTE: Checkpatch has a false positive on the first commit, where it
mistakenly flags a cast before an address-of operator as a bitwise
and operator missing spaces.

Signed-off-by: Gal Horowitz <galush.horowitz@gmail.com>
---
Changes in v4:
- Added commit descriptions
- Added check of CreateThread's return value
- Link to v3: https://lore.kernel.org/qemu-devel/20250924-fix-win32-multiple-taps-v3-0-9335df866c14@gmail.com

Changes in v3:
- Split to multiple commits
- Link to v2: https://lore.kernel.org/qemu-devel/20250923-fix-win32-multiple-taps-v2-1-d497e5ac446f@gmail.com

Changes in v2:
- Add cleanup of the structure fields
- Terminate the thread before freeing the structure
- Link to v1: https://lore.kernel.org/qemu-devel/20250920-fix-win32-multiple-taps-v1-1-bee41dcc213d@gmail.com

---
Gal Horowitz (2):
      tap-win32: cleanup leaked handles on tap close
      tap-win32: allocate separate tap state for each instance

 net/tap-win32.c | 51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 40 insertions(+), 11 deletions(-)
---
base-commit: 18f6f30b0089b470f3e737637a86dfb81ebd6eae
change-id: 20250920-fix-win32-multiple-taps-ed16ccefbd17

Best regards,
-- 
Gal Horowitz <galush.horowitz@gmail.com>



             reply	other threads:[~2025-10-17 12:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 11:59 Gal Horowitz [this message]
2025-10-17 11:59 ` [PATCH v4 1/2] tap-win32: cleanup leaked handles on tap close Gal Horowitz
2025-10-17 11:59 ` [PATCH v4 2/2] tap-win32: allocate separate tap state for each instance Gal Horowitz

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=20251017-fix-win32-multiple-taps-v4-0-483415799ed8@gmail.com \
    --to=galush.horowitz@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /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 NNTP newsgroup(s).