[PATCH 25.11] common/cnxk: check for null callback in CPT interrupt

Aarnav JP ajp at marvell.com
Fri Dec 4 07:39:29 CET 2026


[ upstream commit 6227958923abba2f63669510b78918431e9840e4 ]

nix_inl_cpt_cq_cb() dispatched through inl_dev->work_cb() without a NULL
check, unlike the SSO sibling path. A CPT completion processed before the
callback is registered or after it is cleared caused a NULL
function-pointer call on the interrupt thread, crashing the PMD.

Snapshot the callback once and skip dispatch when it is NULL; the entries
are still drained and the interrupt acknowledged, so the queue does not
stall.

Fixes: a7d64a7740e0 ("net/cnxk: handle soft expiry")
Cc: stable at dpdk.org

Signed-off-by: Aarnav JP <ajp at marvell.com>
---
 drivers/common/cnxk/roc_nix_inl_dev_irq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_nix_inl_dev_irq.c b/drivers/common/cnxk/roc_nix_inl_dev_irq.c
index 3d7d9dba54..a66d5d9864 100644
--- a/drivers/common/cnxk/roc_nix_inl_dev_irq.c
+++ b/drivers/common/cnxk/roc_nix_inl_dev_irq.c
@@ -53,6 +53,7 @@ nix_inl_cpt_cq_cb(struct roc_cpt_lf *lf)
 	uint32_t port_id = roc_nix->port_id;
 	struct nix_inl_dev *inl_dev = NULL;
 	struct roc_ow_ipsec_outb_sa *sa;
+	roc_nix_inl_sso_work_cb_t work_cb;
 	union cpt_lf_cq_base cq_base;
 	union cpt_lf_cq_ptr cq_ptr;
 	struct cpt_cq_s *cq_s;
@@ -75,6 +76,9 @@ nix_inl_cpt_cq_cb(struct roc_cpt_lf *lf)
 	count = cq_ptr.s.count;
 	nq_ptr = cq_ptr.s.nq_ptr;
 
+	/* Snapshot once so the test and the call use the same pointer */
+	work_cb = inl_dev->work_cb;
+
 	for (i = 0; i < count; i++) {
 		cq_s = (struct cpt_cq_s *)(uintptr_t)((((uint64_t)cq_base.s.addr << 7)) +
 						      (head << 5));
@@ -92,7 +96,8 @@ nix_inl_cpt_cq_cb(struct roc_cpt_lf *lf)
 				goto done;
 			}
 			uint64_t tmp = ~(uint32_t)0x0;
-			inl_dev->work_cb(&tmp, sa, NIX_INL_CPT_CQ, (void *)cq_s, port_id);
+			if (work_cb)
+				work_cb(&tmp, sa, NIX_INL_CPT_CQ, (void *)cq_s, port_id);
 		}
 done:
 		head = (head + 1) % lf->cq_size;
-- 
2.43.0



More information about the stable mailing list