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 <[email protected]> --- Changes in v4: - Added commit descriptions - Added check of CreateThread's return value - Link to v3: https://lore.kernel.org/qemu-devel/[email protected] Changes in v3: - Split to multiple commits - Link to v2: https://lore.kernel.org/qemu-devel/[email protected] 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/[email protected] --- 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 <[email protected]>
