All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: mptfusion: Fix potential chain array leaks on attach failure
@ 2026-11-13 14:18 Guangshuo Li
  2026-11-13 14:35 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-11-13 14:18 UTC (permalink / raw)
  To: Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani,
	Ranjan Kumar
  Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel

initChainBuffers() can allocate some chain control arrays before IOC
bring-up fails. mpt_attach() then frees the adapter without releasing
those arrays.

Free the chain control arrays before freeing the adapter on this path.
This also handles partial allocation failures without invoking teardown
that requires a fully initialized adapter.

This issue was found by our static analysis tool under development.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
 drivers/message/fusion/mptbase.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 3a431ffd3e2e..a0592404472c 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -2015,6 +2015,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
 		destroy_workqueue(ioc->reset_work_q);
 		ioc->reset_work_q = NULL;
 
+		kfree(ioc->ChainToChain);
+		kfree(ioc->RequestNB);
+		kfree(ioc->ReqToChain);
 		kfree(ioc);
 		return r;
 	}

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-13 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 14:18 [PATCH] scsi: mptfusion: Fix potential chain array leaks on attach failure Guangshuo Li
2026-11-13 14:35 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.