[PATCH v3 1/2] net/tap: fix FD leak on netns change

Stephen Hemminger stephen at networkplumber.org
Tue Nov 10 17:54:13 CET 2026


On Tue, 10 Nov 2026 11:03:07 +0100
David Marchand <david.marchand at redhat.com> wrote:

> When a tap interface moves to another namespace, tap_netns_change()
> calls tap_lsc_intr_handle_set(dev, 1) to recreate the LSC interrupt
> without first tearing down the old one. The previous LSC netlink
> socket fd is never closed.
> 
> Defer the full LSC teardown and re-registration to an alarm callback
> which runs in the interrupt thread but outside any active source
> context. The alarm switches to the device's network namespace, tears
> down the old LSC handle, sets up a new one (opening a fresh netlink
> socket in the correct namespace), restores the original namespace,
> and forces carrier state back up.
> 
> Extract tap_dev_ns_switch/tap_dev_ns_restore helpers to share the
> namespace switch logic between tap_netns_change and the alarm.
> 
> Fixes: aae3a38e9e03 ("net/tap: detect namespace change")
> Cc: stable at dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> Reviewed-by: Robin Jarry <rjarry at redhat.com>
> ---

Looks good applied to next-net


More information about the dev mailing list