|SUCCESS| [v3,2/2] net/tap: fix use after free on interrupt handle

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Nov 10 23:42:28 CET 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/172794

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-10

**Patch 1/2: net/tap: fix FD leak on netns change**

Info: `tap_netns_change()` now returns 0 for real namespace-switch failures, not just a deleted interface.
```
	if (tap_dev_ns_switch(pmd, &orig_netns_fd) < 0)
		return 0;
```
`tap_dev_ns_switch()` returns -1 in three cases:
- the interface was deleted (`TUNGETDEVNETNS` fails);
- `open("/proc/self/ns/net")` fails;
- `setns()` fails.

Before this patch, the last two returned -1 from `tap_netns_change()`; now all three return 0.

`pmd->if_index` is also cleared before the switch, so in these error cases the device is left with `if_index == 0` and no error is reported to the caller.

If the -1 return was intended, it could be kept by having `tap_dev_ns_switch()` distinguish "interface deleted" (for example, return 1) from real errors.

Info: In `tap_lsc_register_alarm()`, the old LSC netlink fd stays registered and open if the namespace switch fails.
```
	if (tap_dev_ns_switch(pmd, &orig_netns_fd) < 0)
		return;
```
In that case:
- `tap_lsc_intr_handle_set(dev, 0)` is skipped, so the old fd remains registered and open until the next close or stop.
- The carrier is not forced back up.

This path is only reached on unusual failures (interface deleted, or `setns()` failing), and the fd is still reclaimed on teardown. It is noted only so the behaviour is intentional.

Review-Result: CLEAN


More information about the test-report mailing list