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

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Thu Nov 12 10:07:12 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

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

**Error: `irq_config()` failure leaks the new per-vector state**

The tail of `plt_irq_register()` still returns `irq_config()` directly:

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

If `irq_config()` fails, the caller gets an error, but several things are left behind:

- the `plt_irq_vec` stays on `plt_irq_vec_list`;
- its private interrupt handle and eventfd remain allocated;
- the callback stays registered with EAL;
- `efds[vec]` still holds the fd.

Any retry of `plt_irq_register()` for the same vector then fails with `-EEXIST`. Before this patch only the eventfd leaked on this path. Now a heap object, an interrupt instance and a live EAL interrupt source leak too. This contradicts the commit message's claim to "unwind all error paths".

Suggested fix: check the result and unwind.

```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;
```

Also restore any `nb_efd`/`max_intr` updates made just above, if they need reverting.

**Info: duplicate-vector check runs after all allocations**

The `irq_vec_find()` duplicate check happens only after `calloc()`, `plt_intr_instance_alloc()`, `eventfd()` and the handle setup. It would be cheaper to reject an already-registered vector before allocating anything. This is not a correctness issue, because the error path frees everything.

**Info: mixed `plt_` and `rte_` naming on the lock**

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

This mixes the `plt_` abstraction type with an `rte_` initializer. Use the `plt_` equivalent of the initializer if one exists, to stay consistent with the rest of the ROC platform layer.

Review-Result: ERROR


More information about the test-report mailing list