* [PATCH] octeontx2-af: Fix partial NPA health reporter cleanup
@ 2026-12-01 14:12 Guanxin Li
2026-12-01 14:19 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Guanxin Li @ 2026-12-01 14:12 UTC (permalink / raw)
To: Sunil Goutham, Ratheesh Kannoth, Geetha sowjanya,
Subbaraya Sundeep, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, George Cherian, Jerin Jacob, netdev
Cc: Guanxin Li
NPA health reporter setup allocates a container and an event context
before creating the individual reporters. If setup fails before the
RAS reporter is created, teardown skips the container and leaks the
allocations and any reporters already created.
Unwind failed setup before registering NPA interrupts. Destroy the
reporters that were created, free the event context and container,
and clear the container pointer so the outer teardown can skip it.
Return the original setup error.
Check the NIX container before dereferencing it in the shared teardown,
since NIX setup may not have started when NPA setup fails.
Fixes: f1168d1e207c ("octeontx2-af: Add devlink health reporters for NPA")
Signed-off-by: Guanxin Li <202635561@mail.sdu.edu.cn>
---
.../marvell/octeontx2/af/rvu_devlink.c | 90 ++++++++++++-------
1 file changed, 56 insertions(+), 34 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
index c7c7230dc588..0268cfa443ff 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
@@ -581,7 +581,7 @@ static void rvu_nix_health_reporters_destroy(struct rvu_devlink *rvu_dl)
nix_reporters = rvu_dl->rvu_nix_health_reporter;
- if (!nix_reporters->rvu_hw_nix_ras_reporter)
+ if (!nix_reporters || !nix_reporters->rvu_hw_nix_ras_reporter)
return;
rvu_nix_unregister_interrupts(rvu);
@@ -1048,13 +1048,35 @@ RVU_REPORTERS(hw_npa_gen);
RVU_REPORTERS(hw_npa_err);
RVU_REPORTERS(hw_npa_ras);
-static void rvu_npa_health_reporters_destroy(struct rvu_devlink *rvu_dl);
+static void rvu_npa_health_reporters_free(struct rvu_devlink *rvu_dl)
+{
+ struct rvu_npa_health_reporters *npa_reporters;
+
+ npa_reporters = rvu_dl->rvu_npa_health_reporter;
+
+ if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_intr_reporter))
+ devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_intr_reporter);
+
+ if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_gen_reporter))
+ devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_gen_reporter);
+
+ if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_err_reporter))
+ devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_err_reporter);
+
+ if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_ras_reporter))
+ devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_ras_reporter);
+
+ kfree(npa_reporters->npa_event_ctx);
+ kfree(npa_reporters);
+ rvu_dl->rvu_npa_health_reporter = NULL;
+}
static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
{
struct rvu_npa_health_reporters *rvu_reporters;
struct rvu_npa_event_ctx *npa_event_context;
struct rvu *rvu = rvu_dl->rvu;
+ int err;
rvu_reporters = kzalloc_obj(*rvu_reporters);
if (!rvu_reporters)
@@ -1062,8 +1084,10 @@ static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
rvu_dl->rvu_npa_health_reporter = rvu_reporters;
npa_event_context = kzalloc_obj(*npa_event_context);
- if (!npa_event_context)
- return -ENOMEM;
+ if (!npa_event_context) {
+ err = -ENOMEM;
+ goto err_free_reporters;
+ }
rvu_reporters->npa_event_ctx = npa_event_context;
INIT_WORK(&rvu_reporters->intr_work, rvu_npa_intr_work);
@@ -1076,19 +1100,21 @@ static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
&rvu_hw_npa_intr_reporter_ops,
rvu);
if (IS_ERR(rvu_reporters->rvu_hw_npa_intr_reporter)) {
- dev_warn(rvu->dev, "Failed to create hw_npa_intr reporter, err=%ld\n",
- PTR_ERR(rvu_reporters->rvu_hw_npa_intr_reporter));
- return PTR_ERR(rvu_reporters->rvu_hw_npa_intr_reporter);
+ err = PTR_ERR(rvu_reporters->rvu_hw_npa_intr_reporter);
+ dev_warn(rvu->dev, "Failed to create hw_npa_intr reporter, err=%d\n",
+ err);
+ goto err_free_reporters;
}
rvu_reporters->rvu_hw_npa_gen_reporter =
devlink_health_reporter_create(rvu_dl->dl,
&rvu_hw_npa_gen_reporter_ops,
- rvu);
+ rvu);
if (IS_ERR(rvu_reporters->rvu_hw_npa_gen_reporter)) {
- dev_warn(rvu->dev, "Failed to create hw_npa_gen reporter, err=%ld\n",
- PTR_ERR(rvu_reporters->rvu_hw_npa_gen_reporter));
- return PTR_ERR(rvu_reporters->rvu_hw_npa_gen_reporter);
+ err = PTR_ERR(rvu_reporters->rvu_hw_npa_gen_reporter);
+ dev_warn(rvu->dev, "Failed to create hw_npa_gen reporter, err=%d\n",
+ err);
+ goto err_free_reporters;
}
rvu_reporters->rvu_hw_npa_err_reporter =
@@ -1096,9 +1122,10 @@ static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
&rvu_hw_npa_err_reporter_ops,
rvu);
if (IS_ERR(rvu_reporters->rvu_hw_npa_err_reporter)) {
- dev_warn(rvu->dev, "Failed to create hw_npa_err reporter, err=%ld\n",
- PTR_ERR(rvu_reporters->rvu_hw_npa_err_reporter));
- return PTR_ERR(rvu_reporters->rvu_hw_npa_err_reporter);
+ err = PTR_ERR(rvu_reporters->rvu_hw_npa_err_reporter);
+ dev_warn(rvu->dev, "Failed to create hw_npa_err reporter, err=%d\n",
+ err);
+ goto err_free_reporters;
}
rvu_reporters->rvu_hw_npa_ras_reporter =
@@ -1106,17 +1133,25 @@ static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
&rvu_hw_npa_ras_reporter_ops,
rvu);
if (IS_ERR(rvu_reporters->rvu_hw_npa_ras_reporter)) {
- dev_warn(rvu->dev, "Failed to create hw_npa_ras reporter, err=%ld\n",
- PTR_ERR(rvu_reporters->rvu_hw_npa_ras_reporter));
- return PTR_ERR(rvu_reporters->rvu_hw_npa_ras_reporter);
+ err = PTR_ERR(rvu_reporters->rvu_hw_npa_ras_reporter);
+ dev_warn(rvu->dev, "Failed to create hw_npa_ras reporter, err=%d\n",
+ err);
+ goto err_free_reporters;
}
if (!rvu_dl->devlink_wq)
rvu_dl->devlink_wq = create_workqueue("rvu_devlink_wq");
- if (!rvu_dl->devlink_wq)
- return -ENOMEM;
+ if (!rvu_dl->devlink_wq) {
+ err = -ENOMEM;
+ goto err_free_reporters;
+ }
return 0;
+
+err_free_reporters:
+ /* NPA interrupts are registered only after this function succeeds. */
+ rvu_npa_health_reporters_free(rvu_dl);
+ return err;
}
static int rvu_npa_health_reporters_create(struct rvu_devlink *rvu_dl)
@@ -1142,7 +1177,7 @@ static void rvu_npa_health_reporters_destroy(struct rvu_devlink *rvu_dl)
npa_reporters = rvu_dl->rvu_npa_health_reporter;
- if (!npa_reporters->rvu_hw_npa_ras_reporter)
+ if (!npa_reporters)
return;
rvu_npa_unregister_interrupts(rvu);
@@ -1151,20 +1186,7 @@ static void rvu_npa_health_reporters_destroy(struct rvu_devlink *rvu_dl)
cancel_work_sync(&npa_reporters->err_work);
cancel_work_sync(&npa_reporters->ras_work);
- if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_intr_reporter))
- devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_intr_reporter);
-
- if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_gen_reporter))
- devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_gen_reporter);
-
- if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_err_reporter))
- devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_err_reporter);
-
- if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_ras_reporter))
- devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_ras_reporter);
-
- kfree(rvu_dl->rvu_npa_health_reporter->npa_event_ctx);
- kfree(rvu_dl->rvu_npa_health_reporter);
+ rvu_npa_health_reporters_free(rvu_dl);
}
static int rvu_health_reporters_create(struct rvu *rvu)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] octeontx2-af: Fix partial NPA health reporter cleanup
2026-12-01 14:12 [PATCH] octeontx2-af: Fix partial NPA health reporter cleanup Guanxin Li
@ 2026-12-01 14:19 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-12-01 14:19 UTC (permalink / raw)
To: Guanxin Li
Cc: Sunil Goutham, Ratheesh Kannoth, Geetha sowjanya,
Subbaraya Sundeep, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, George Cherian, Jerin Jacob, netdev
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
- What hardware the change was tested on. For driver fixes please
mention the device (and if relevant firmware version) used for
testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-01 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 14:12 [PATCH] octeontx2-af: Fix partial NPA health reporter cleanup Guanxin Li
2026-12-01 14:19 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox