* [PATCH] crypto/testmgr: Fix acomp_req leak
@ 2025-04-08 4:16 Li Zhijian
2025-04-08 4:22 ` Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: Li Zhijian @ 2025-04-08 4:16 UTC (permalink / raw)
To: herbert, davem, linux-crypto
Cc: mcoquelin.stm32, alexandre.torgue, linux-stm32, linux-arm-kernel,
linux-kernel, Li Zhijian, Erhard Furtner
The kmemleak reported that
...
unreferenced object 0xffff888108d6c300 (size 256):
comm "cryptomgr_test", pid 183, jiffies 4294700957
hex dump (first 32 bytes):
00 c1 d6 08 81 88 ff ff 00 cb d6 08 81 88 ff ff ................
50 cd a7 81 ff ff ff ff b8 fb 93 02 00 c9 ff ff P...............
backtrace (crc 29cca632):
__kmalloc_noprof+0x2fa/0x430
test_acomp+0x174/0x960
alg_test_comp+0x6f/0x90
alg_test.part.26+0x105/0x410
cryptomgr_test+0x20/0x40
kthread+0x10c/0x250
ret_from_fork+0x30/0x40
ret_from_fork_asm+0x1a/0x30
unreferenced object 0xffff888108d6c100 (size 256):
comm "cryptomgr_test", pid 183, jiffies 4294700972
hex dump (first 32 bytes):
00 1d da 08 81 88 ff ff 00 c3 d6 08 81 88 ff ff ................
50 cd a7 81 ff ff ff ff b8 fb 93 02 00 c9 ff ff P...............
backtrace (crc 3047d62b):
__kmalloc_noprof+0x2fa/0x430
test_acomp+0x174/0x960
alg_test_comp+0x6f/0x90
alg_test.part.26+0x105/0x410
cryptomgr_test+0x20/0x40
kthread+0x10c/0x250
ret_from_fork+0x30/0x40
ret_from_fork_asm+0x1a/0x30
acomp_request will be chained to req[0], however,
acomp_request_free(), it will not free the whole chain.
Fix it by freeing them one by one.
Fixes: 99585c2192cb ("crypto: testmgr - Add multibuffer acomp testing")
Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Closes: https://lore.kernel.org/linux-crypto/20250408002741.089f1e9a@outsider.home/
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
crypto/testmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index abd609d4c8ef..7f02feee9fb6 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -3498,10 +3498,10 @@ static int test_acomp(struct crypto_acomp *tfm,
ret = 0;
out:
- acomp_request_free(reqs[0]);
for (i = 0; i < MAX_MB_MSGS; i++) {
kfree(output[i]);
kfree(decomp_out[i]);
+ acomp_request_free(reqs[i]);
}
kfree(dst);
kfree(src);
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto/testmgr: Fix acomp_req leak
2025-04-08 4:16 [PATCH] crypto/testmgr: Fix acomp_req leak Li Zhijian
@ 2025-04-08 4:22 ` Herbert Xu
2025-04-08 5:39 ` Zhijian Li (Fujitsu)
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2025-04-08 4:22 UTC (permalink / raw)
To: Li Zhijian
Cc: davem, linux-crypto, mcoquelin.stm32, alexandre.torgue,
linux-stm32, linux-arm-kernel, linux-kernel, Erhard Furtner
On Tue, Apr 08, 2025 at 12:16:47PM +0800, Li Zhijian wrote:
> The kmemleak reported that
> ...
> unreferenced object 0xffff888108d6c300 (size 256):
> comm "cryptomgr_test", pid 183, jiffies 4294700957
> hex dump (first 32 bytes):
> 00 c1 d6 08 81 88 ff ff 00 cb d6 08 81 88 ff ff ................
> 50 cd a7 81 ff ff ff ff b8 fb 93 02 00 c9 ff ff P...............
> backtrace (crc 29cca632):
> __kmalloc_noprof+0x2fa/0x430
> test_acomp+0x174/0x960
> alg_test_comp+0x6f/0x90
> alg_test.part.26+0x105/0x410
> cryptomgr_test+0x20/0x40
> kthread+0x10c/0x250
> ret_from_fork+0x30/0x40
> ret_from_fork_asm+0x1a/0x30
> unreferenced object 0xffff888108d6c100 (size 256):
> comm "cryptomgr_test", pid 183, jiffies 4294700972
> hex dump (first 32 bytes):
> 00 1d da 08 81 88 ff ff 00 c3 d6 08 81 88 ff ff ................
> 50 cd a7 81 ff ff ff ff b8 fb 93 02 00 c9 ff ff P...............
> backtrace (crc 3047d62b):
> __kmalloc_noprof+0x2fa/0x430
> test_acomp+0x174/0x960
> alg_test_comp+0x6f/0x90
> alg_test.part.26+0x105/0x410
> cryptomgr_test+0x20/0x40
> kthread+0x10c/0x250
> ret_from_fork+0x30/0x40
> ret_from_fork_asm+0x1a/0x30
>
> acomp_request will be chained to req[0], however,
> acomp_request_free(), it will not free the whole chain.
>
> Fix it by freeing them one by one.
>
> Fixes: 99585c2192cb ("crypto: testmgr - Add multibuffer acomp testing")
> Reported-by: Erhard Furtner <erhard_f@mailbox.org>
> Closes: https://lore.kernel.org/linux-crypto/20250408002741.089f1e9a@outsider.home/
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
> crypto/testmgr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks for the patch but this will be removed by
https://patchwork.kernel.org/project/linux-crypto/patch/048b1e176dd3507ec31497ccf215630dc2b2ed04.1744018301.git.herbert@gondor.apana.org.au/
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto/testmgr: Fix acomp_req leak
2025-04-08 4:22 ` Herbert Xu
@ 2025-04-08 5:39 ` Zhijian Li (Fujitsu)
0 siblings, 0 replies; 3+ messages in thread
From: Zhijian Li (Fujitsu) @ 2025-04-08 5:39 UTC (permalink / raw)
To: Herbert Xu
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org,
mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Erhard Furtner
Got it. Let's drop this patch. :)
On 08/04/2025 12:22, Herbert Xu wrote:
> Thanks for the patch but this will be removed by
>
> https://patchwork.kernel.org/project/linux-crypto/patch/048b1e176dd3507ec31497ccf215630dc2b2ed04.1744018301.git.herbert@gondor.apana.org.au/
>
> Cheers,
> --
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-08 5:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 4:16 [PATCH] crypto/testmgr: Fix acomp_req leak Li Zhijian
2025-04-08 4:22 ` Herbert Xu
2025-04-08 5:39 ` Zhijian Li (Fujitsu)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).