|WARNING| eal/linux: revert eventfd leak fix for MSI-X

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Thu Nov 19 03:28:42 CET 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/173036

_AI Code Review_

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

lib/eal/linux/eal_interrupts.c: rte_intr_efd_enable()

Errors

1. Eventfds created in earlier iterations leak when eventfd() fails partway through the loop.

```
fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
if (fd < 0) {
	...
	return -errno;
}
```

   Descriptors 0..i-1 have already been stored with `rte_intr_efds_index_set()`. However, `nb_efd` is only set after the loop, so it is still 0 here. A caller's later `rte_intr_efd_disable()` therefore cannot find these fds, and they are never closed.

2. The fd just created leaks if `rte_intr_efds_index_set()` fails.

```
if (rte_intr_efds_index_set(intr_handle, i, fd))
	return -rte_errno;
```

   `fd` is never closed on this path. The earlier fds leak for the same reason as in item 1.

3. The same leak occurs if `rte_intr_nb_efd_set()` or `rte_intr_max_intr_set()` fails.

```
if (rte_intr_nb_efd_set(intr_handle, n))
	return -rte_errno;

if (rte_intr_max_intr_set(intr_handle, NB_OTHER_INTR + n))
	return -rte_errno;
```

   All `n` eventfds have been created at this point and none are closed on these error returns.

These leaks are being re-added deliberately as part of the revert. Even so, this function's error paths would be safer with an error-cleanup block that closes every fd created so far, which the reverted commit had.

A narrower option is to drop only the part of the reverted change that alters behaviour for callers. That is the new `-EBUSY` rejection when `nb_efd != 0`, plus `nb_efd` now being updated incrementally. The local close-on-error cleanup could stay.

Warnings

1. The return value can be a stale `errno` after logging.

```
EAL_LOG(ERR,
	"can't setup eventfd, error %i (%s)",
	errno, strerror(errno));
return -errno;
```

   `EAL_LOG()` performs I/O (log stream or syslog), which may modify `errno` before it is read for the return value. The function could then return an error code unrelated to the eventfd failure.

   The reverted code avoided this by saving `ret = -errno;` before logging. Keep that ordering:

```
int ret = -errno;
EAL_LOG(ERR, "can't setup eventfd, error %i (%s)",
	-ret, strerror(-ret));
return ret;
```

Review-Result: ERROR


More information about the test-report mailing list