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

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Nov 10 18:32:40 CET 2026


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

_AI Code Review_

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

**drivers/common/cnxk/roc_platform.c**

Warning: `plt_irq_register()` does not unwind when `irq_config()` fails.
```c
	/* Enable MSIX vectors to VFIO */
	return irq_config(intr_handle, vec);
```
The commit message says all error paths are unwound, and the new `remove_vec`/`free_vec` labels do that for every earlier failure. This last one is missed. If `irq_config()` fails, the function returns an error, but:
- the `irq_vec` entry stays on `plt_irq_vec_list`;
- the callback stays registered on `irq_vec->handle`;
- `efds[vec]` still holds the eventfd.

With the new duplicate check, a caller that retries registration after this failure now gets `-EEXIST`. A caller that treats the failure as "nothing registered" leaks the entry, the handle and the fd.

Suggested fix: capture the return value and unwind on failure.
```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: the list entry is used after the lock is dropped.
```c
	plt_spinlock_lock(&plt_irq_vec_lock);
	irq_vec = irq_vec_find(intr_handle, vec);
	plt_spinlock_unlock(&plt_irq_vec_lock);
```
`irq_vec` is dereferenced after the lock is released (`irq_vec->cb`, `irq_vec->handle`). Two concurrent `plt_irq_unregister()` calls for the same vector could both find the entry, and both would remove and free it. If callers already serialise these calls, the spinlock only protects the list against concurrent register/unregister on different vectors. That is fine, but a short comment stating the assumption would help.

Review-Result: WARNING


More information about the test-report mailing list