FAILED: patch "[PATCH] octeontx2-pf: fix SQB pointer leak on init failure" failed to apply to 5.15-stable tree
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 62e7df6d042aeebd5efb581074e28865c04477be
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072128-robotics-duplicate-a186@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 62e7df6d042aeebd5efb581074e28865c04477be Mon Sep 17 00:00:00 2001
From: Dawei Feng <[email protected]>
Date: Tue, 30 Jun 2026 15:16:25 +0800
Subject: [PATCH] octeontx2-pf: fix SQB pointer leak on init failure
otx2_init_hw_resources() initializes SQ aura and pool resources before several later setup steps. On failure, err_free_sq_ptrs only frees SQB pages, leaving the per-SQ sqb_ptrs arrays behind.
Use otx2_free_sq_res() for the SQ unwind path and let it free sqb_ptrs even when sq->sqe has not been allocated yet.
The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1.1.
An x86_64 allyesconfig build showed no new warnings. As we do not have an OcteonTX2 PF device and the corresponding AF mailbox setup to test with, no runtime testing was able to be performed.
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +10 -11
@@ -1568,15 +1568,15 @@ static void otx2_free_sq_res(struct otx2_nic *pf)otx2_sq_free_sqbs (pf);for (qidx =0 ; qidx <otx2_get_total_tx_queues (pf); qidx++) { sq = &qset->sq[qidx]; -/* Skip freeing Qos queues if they are not initialized */ -if (!sq->sqe) -continue ; -qmem_free (pf->dev, sq->sqe); -qmem_free (pf->dev, sq->sqe_ring); -qmem_free (pf->dev, sq->cpt_resp); -qmem_free (pf->dev, sq->tso_hdrs); -qmem_free (pf->dev, sq->timestamps); -kfree (sq->sg); +/* sq->sqe is not initialized for unused QoS queues */ +if (sq->sqe) { +qmem_free (pf->dev, sq->sqe); +qmem_free (pf->dev, sq->sqe_ring); +qmem_free (pf->dev, sq->cpt_resp); +qmem_free (pf->dev, sq->tso_hdrs); +qmem_free (pf->dev, sq->timestamps); +kfree (sq->sg); + }kfree (sq->sqb_ptrs); } }
@@ -1711,13 +1711,12 @@ int otx2_init_hw_resources(struct otx2_nic *pf)return err; err_free_nix_queues: -otx2_free_sq_res (pf);otx2_free_cq_res (pf);otx2_ctx_disable (mbox,NIX_AQ_CTYPE_RQ , false); err_free_txsch:otx2_txschq_stop (pf); err_free_sq_ptrs: -otx2_sq_free_sqbs (pf); +otx2_free_sq_res (pf); err_free_rq_ptrs:otx2_free_aura_ptr (pf,AURA_NIX_RQ );otx2_ctx_disable (mbox,NPA_AQ_CTYPE_POOL , true);
Sasha Levin
maintainerPATCH 1/1 octeontx2-pf: fix SQB pointer leak on init failure
From: Dawei Feng <[email protected]>
[ Upstream commit 62e7df6d042aeebd5efb581074e28865c04477be ]
otx2_init_hw_resources() initializes SQ aura and pool resources before several later setup steps. On failure, err_free_sq_ptrs only frees SQB pages, leaving the per-SQ sqb_ptrs arrays behind.
Use otx2_free_sq_res() for the SQ unwind path and let it free sqb_ptrs even when sq->sqe has not been allocated yet.
The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1.1.
An x86_64 allyesconfig build showed no new warnings. As we do not have an OcteonTX2 PF device and the corresponding AF mailbox setup to test with, no runtime testing was able to be performed.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 -2
@@ -1485,14 +1485,13 @@ static int otx2_init_hw_resources(struct otx2_nic *pf)return err; err_free_nix_queues: -otx2_free_sq_res (pf);otx2_free_cq_res (pf);otx2_ctx_disable (mbox,NIX_AQ_CTYPE_RQ , false); err_free_txsch:if (otx2_txschq_stop (pf))dev_err (pf->dev,"%s failed to stop TX schedulers\n" , __func__); err_free_sq_ptrs: -otx2_sq_free_sqbs (pf); +otx2_free_sq_res (pf); err_free_rq_ptrs:otx2_free_aura_ptr (pf,AURA_NIX_RQ );otx2_ctx_disable (mbox,NPA_AQ_CTYPE_POOL , true);
Signature · 1 line
2.53.0