fsl/fman: Free init resources on KeyGen failure in fman_init()
Subsystems (3)
PATCH v3 1/1 fsl/fman: Free init resources on KeyGen failure in fman_init()
fman_muram_alloc() allocates initialization resources before initializing the KeyGen block. If keygen_init() fails, the function returns -EINVAL directly and leaves those resources allocated. Free the initialization resources before returning from the KeyGen failure path.
---
Changes in v2:
- Add "net" to patch title. Thanks, Pavan!
Changes in v3:
- Drop the unrelated enable() cleanup from this fix. Thanks, Breno!
--- drivers/net/ethernet/freescale/fman/fman.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fman/fman.c +3 -1
@@ -1995,8 +1995,10 @@ static int fman_init(struct fman *fman)/* Init KeyGen */ fman->keygen =keygen_init (fman->kg_regs); -if (!fman->keygen) +if (!fman->keygen) { +free_init_resources (fman);return -EINVAL ; + } err =enable (fman, cfg);if (err !=0 )
Signature · 1 line
2.25.1
Jakub Kicinski
maintainerQuoted 5 lines · On Thu, 25 Jun 2026 08:48:34 +0800 Haoxiang Li wrote:
fman_muram_alloc()allocates initialization resources before initializing the KeyGen block. Ifkeygen_init()fails, the function returns-EINVALdirectly and leaves those resources allocated. Free the initialization resources before returning from the KeyGen failure path.
Please slow down. You're sending a lot of low value patches. Please do not have more than 5 outstanding "active" networking patches under name at any given time:
https://patchwork.kernel.org/project/netdevbpf/list/?submitter=215341
Quoted 11 lines · Haoxiang Li
fman_muram_alloc()allocates initialization resources before initializing the KeyGen block. Ifkeygen_init()fails, the function returns-EINVALdirectly and leaves those resources allocated. Free the initialization resources before returning from the KeyGen failure path.Fixes 7472f4f281d0 ("fsl/fman: enable FMan Keygen")Signed-off-by Haoxiang Li <[email protected]>Reviewed-by Pavan Chebbi <[email protected]>Reviewed-by Breno Leitao <[email protected]>
The PW bot is on holiday, no automated notifications for a while.
Applied, thanks!
/P