|WARNING| common/cnxk: fix duplicate mbox alloc in NPA aura pool init
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Fri Sep 4 12:23:48 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/169091
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-09-04
# DPDK Patch Review
## Summary
This patch fixes a duplicate mbox allocation bug in `npa_aura_pool_init()` that causes a resource leak and sends an uninitialized message to the AF on non-CN20K platforms.
---
## Errors
### 1. Resource leak on duplicate allocation (correctness bug)
**File:** `drivers/common/cnxk/roc_npa.c`
**Location:** Lines 106-113 (context from patch)
The code allocates a mbox message twice, leaking the first allocation:
```c
if (roc_model_is_cn20k()) {
pool_init_req = mbox_alloc_msg_npa_aq_enq_cn20k(mbox);
} else {
pool_init_req = mbox_alloc_msg_npa_aq_enq(mbox);
}
pool_init_req = mbox_alloc_msg_npa_aq_enq(mbox); /* LEAK: overwrites pointer */
```
The first allocated message (from the if/else block) is orphaned when `pool_init_req` is overwritten at line 112. This leaks the mbox message memory and causes the orphaned message to be sent with uninitialized fields (`aura_id`, `ctype`, `op`), which can trigger undefined behavior in the AF firmware on CN10K platforms.
**The patch correctly removes the duplicate allocation.**
This is a correctness bug (resource leak + uninitialized data sent to firmware). The fix is correct.
---
## Warnings
None.
---
## Info
None.
---
## Overall Assessment
**This patch is correct and should be accepted.**
The duplicate allocation is a clear bug introduced when the CN20K-specific path was added. The fix properly removes the redundant line, ensuring only one allocation occurs per code path. The commit message accurately describes the problem and impact.
**Additional verification recommended:**
- Confirm that `mbox_alloc_msg_*()` functions do not internally track or clean up orphaned messages (if they do, this would still be a bug but with different symptoms)
- Test on both CN10K and CN20K to verify the fix resolves the issue
More information about the test-report
mailing list