linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: "David S . Miller" <davem@davemloft.net>, linux-crypto@vger.kernel.org
Subject: Re: [PATCH] crypto: acomp: fix memory leaks caused by chained requests
Date: Sat, 19 Apr 2025 11:37:59 +0800	[thread overview]
Message-ID: <aAMal2cgiLz62TFP@gondor.apana.org.au> (raw)
In-Reply-To: <20250418100229.9868-1-dmantipov@yandex.ru>

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@yandex.ru>
> ---
>  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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      reply	other threads:[~2025-04-19  3:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18 10:02 [PATCH] crypto: acomp: fix memory leaks caused by chained requests Dmitry Antipov
2025-04-19  3:37 ` Herbert Xu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aAMal2cgiLz62TFP@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=dmantipov@yandex.ru \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).