|WARNING| common/cnxk: use one interrupt handle per vector

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Thu Nov 12 10:31:37 CET 2026


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

_AI Code Review_

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

**Warning: irq_config() failure in plt_irq_register() is not unwound**

The commit message says all error paths of `plt_irq_register()` are now unwound, but the final step is not:

```c
	/* Enable MSIX vectors to VFIO */
	return irq_config(intr_handle, vec);
```

If `irq_config()` fails, several things are left in place:
- `irq_vec` stays on `plt_irq_vec_list`.
- The EAL callback stays registered on `irq_vec->handle`.
- The eventfd stays stored in the efds slot.

Because the patch adds an `-EEXIST` check via `irq_vec_find()`, a caller that retries registration for the same vector after this failure is now rejected. Before this patch, a retry would simply have overwritten the state.

Suggested fix: check the return value and unwind before returning.

```c
	rc = irq_config(intr_handle, vec);
	if (rc) {
		plt_intr_efds_index_set(intr_handle, vec, -1);
		plt_intr_callback_unregister(irq_vec->handle, cb, data);
		goto remove_vec;
	}
	return 0;
```

**Info: irq_vec is used after the lock is dropped in plt_irq_unregister()**

```c
	plt_spinlock_lock(&plt_irq_vec_lock);
	irq_vec = irq_vec_find(intr_handle, vec);
	plt_spinlock_unlock(&plt_irq_vec_lock);
```

After the lock is released, `irq_vec` is dereferenced (`irq_vec->cb`, `irq_vec->handle`). Later it is removed from the list and freed.

Two concurrent unregisters of the same vector would both find the entry. That leads to a double `TAILQ_REMOVE` and a double free.

This is control-path code, so the window is narrow. Still, removing the entry from the list while the lock is held at lookup time would make ownership unambiguous. The entry can be re-inserted if the callback unregister fails.

**Info: mixed rte_/plt_ naming**

```c
static plt_spinlock_t plt_irq_vec_lock = RTE_SPINLOCK_INITIALIZER;
```

This file otherwise goes through the `plt_` abstraction layer. Consider using the `plt_` aliases for the initializer and for `RTE_INTR_INSTANCE_F_PRIVATE`, if aliases exist, so the file stays consistent.

Review-Result: WARNING


More information about the test-report mailing list