Re: [PATCH] crypto: acomp: fix memory leaks caused by chained requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 18, 2025 at 01:02:29PM +0300, Dmitry Antipov wrote:
> Running 6.15.0-rc2 with kmemleak enabled, I've noticed 45
> memory leaks looks like the following:
> 
> unreferenced object 0xffff888114032a00 (size 256):
>   comm "cryptomgr_test", pid 246, jiffies 4294668840
>   hex dump (first 32 bytes):
>     00 20 03 14 81 88 ff ff 00 da 02 14 81 88 ff ff  . ..............
>     90 ca 54 9b ff ff ff ff c8 fb a6 00 00 c9 ff ff  ..T.............
>   backtrace (crc cd58738d):
>     __kmalloc_noprof+0x272/0x520
>     alg_test_comp+0x74e/0x1b60
>     alg_test+0x3f0/0xc40
>     cryptomgr_test+0x47/0x80
>     kthread+0x4e1/0x620
>     ret_from_fork+0x37/0x70
>     ret_from_fork_asm+0x1a/0x30
> 
> These leaks comes from 'test_acomp()' where an extra requests chained to
> the head one (e.g. 'reqs[0]') are never freed. Fix this by unchaining
> and freeing such an extra requests in 'acomp_request_free()'.
> 
> (I'm new to this subsystem and not sure about Fixes: tag BTW).
> 
> Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
> ---
>  include/crypto/acompress.h | 28 ++++++++++++++++++++++------
>  include/linux/crypto.h     |  5 +++++
>  2 files changed, 27 insertions(+), 6 deletions(-)

Thanks for the patch! I'll fix this by reverting the multibuffer
acomp tests:

https://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git/commit/?id=aece1cf146741761a1243746db5b72f5ece68290
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux