linux/drivers/crypto/caam
Jianpeng Chang 7d43252b30 crypto: caam - fix netdev memory leak in dpaa2_caam_probe
When commit 0e1a4d427f ("crypto: caam: Unembed net_dev structure in
dpaa2") converted embedded net_device to dynamically allocated pointers,
it added cleanup in dpaa2_dpseci_disable() but missed adding cleanup in
dpaa2_dpseci_free() for error paths.

This causes memory leaks when dpaa2_dpseci_dpio_setup() fails during probe
due to DPIO devices not being ready yet. The kernel's deferred probe
mechanism handles the retry successfully, but the netdevs allocated during
the failed probe attempt are never freed, resulting in kmemleak reports
showing multiple leaked netdev-related allocations all traced back to
dpaa2_caam_probe().

Fix this by preserving the CPU mask of allocated netdevs during setup and
using it for cleanup in dpaa2_dpseci_free(). This approach ensures that
only the CPUs that actually had netdevs allocated will be cleaned up,
avoiding potential issues with CPU hotplug scenarios.

Fixes: 0e1a4d427f ("crypto: caam: Unembed net_dev structure in dpaa2")
Signed-off-by: Jianpeng Chang <jianpeng.chang.cn@windriver.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-01-31 10:52:31 +08:00
..
blob_gen.c KEYS: trusted: caam based protected key 2025-10-20 12:10:28 +08:00
caamalg.c crypto: caam - Add support of paes algorithm 2025-10-20 12:10:28 +08:00
caamalg_desc.c crypto: caam - Add support of paes algorithm 2025-10-20 12:10:28 +08:00
caamalg_desc.h crypto: caam - Add support of paes algorithm 2025-10-20 12:10:28 +08:00
caamalg_qi.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
caamalg_qi2.c crypto: caam - fix netdev memory leak in dpaa2_caam_probe 2026-01-31 10:52:31 +08:00
caamalg_qi2.h crypto: caam - fix netdev memory leak in dpaa2_caam_probe 2026-01-31 10:52:31 +08:00
caamhash.c crypto: caam - Pad SG length when allocating hash edesc 2024-09-21 17:14:59 +08:00
caamhash_desc.c crypto: caam - drop unexpected word 'for' in comments 2022-06-30 15:56:57 +08:00
caamhash_desc.h crypto: caam - keep both virtual and dma key addresses 2019-08-09 15:11:49 +10:00
caampkc.c crypto: caam - add error check to caam_rsa_set_priv_key_form 2024-11-15 19:52:51 +08:00
caampkc.h crypto: caam - Use new crypto_engine_op interface 2023-08-18 17:01:10 +08:00
caamprng.c crypto: caam - Remove GFP_DMA and add DMA alignment padding 2023-01-06 17:15:47 +08:00
caamrng.c crypto: caam - Add check for kcalloc() in test_len() 2025-10-17 16:03:57 +08:00
compat.h crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
ctrl.c crypto: caam - double the entropy delay interval for retry 2025-09-13 12:11:06 +08:00
ctrl.h crypto: caam - staticize caam_get_era() 2018-04-21 00:58:36 +08:00
debugfs.c crypto: caam - avoid option aliasing with the CONFIG_CAAM_QI build option 2025-07-18 20:51:59 +10:00
debugfs.h crypto: caam - avoid option aliasing with the CONFIG_CAAM_QI build option 2025-07-18 20:51:59 +10:00
desc.h KEYS: trusted: caam based protected key 2025-10-20 12:10:28 +08:00
desc_constr.h crypto: caam - Add support of paes algorithm 2025-10-20 12:10:28 +08:00
dpseci-debugfs.c crypto: caam - remove unnecessary (void*) conversions 2023-03-24 18:22:29 +08:00
dpseci-debugfs.h crypto: caam/qi2 - Add printing dpseci fq stats using debugfs 2019-08-02 14:44:01 +10:00
dpseci.c crypto: caam/qi2 - add support for dpseci_reset() 2020-06-18 17:19:45 +10:00
dpseci.h crypto: caam/qi2 - add support for dpseci_reset() 2020-06-18 17:19:45 +10:00
dpseci_cmd.h crypto: caam/qi2 - add support for dpseci_reset() 2020-06-18 17:19:45 +10:00
error.c crypto: caam - add more RNG hw error codes 2020-07-31 18:25:28 +10:00
error.h crypto: caam - fix return code in completion callbacks 2019-08-09 15:11:45 +10:00
intern.h crypto: caam - avoid option aliasing with the CONFIG_CAAM_QI build option 2025-07-18 20:51:59 +10:00
jr.c crypto: engine - remove request batching support 2025-07-18 20:52:00 +10:00
jr.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig crypto: caam: Make CRYPTO_DEV_FSL_CAAM dependent of COMPILE_TEST 2024-07-04 10:19:23 -07:00
key_gen.c crypto: caam - Remove GFP_DMA and add DMA alignment padding 2023-01-06 17:15:47 +08:00
key_gen.h crypto: caam - add Derived Key Protocol (DKP) support 2017-12-28 17:56:48 +11:00
Makefile crypto: caam - avoid option aliasing with the CONFIG_CAAM_QI build option 2025-07-18 20:51:59 +10:00
pdb.h treewide: Replace zero-length arrays with flexible-array members 2022-02-17 07:00:39 -06:00
pkc_desc.c crypto: caam - select DMA address size at runtime 2019-08-30 18:05:30 +10:00
qi.c crypto: caam - Fix opencoded cpumask_next_wrap() in caam_drv_ctx_init() 2025-06-13 17:26:17 +08:00
qi.h crypto: caam - Remove GFP_DMA and add DMA alignment padding 2023-01-06 17:15:47 +08:00
regs.h crypto: caam - add power management support 2023-08-04 16:59:55 +08:00
sg_sw_qm.h crypto: caam - use len instead of nents for bulding HW S/G table 2019-06-20 14:18:33 +08:00
sg_sw_qm2.h crypto: caam - use len instead of nents for bulding HW S/G table 2019-06-20 14:18:33 +08:00
sg_sw_sec4.h crypto: caam - use len instead of nents for bulding HW S/G table 2019-06-20 14:18:33 +08:00