From: Eric Biggers <ebiggers@kernel.org>
To: ZhaoJinming <zhaojinming@uniontech.com>
Cc: Bartosz Golaszewski <brgl@kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Thara Gopinath <thara.gopinath@linaro.org>,
linux-crypto@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 0/3] crypto: qce - fix CCM AAD buffer leak and the AEAD error paths
Date: Fri, 16 Oct 2026 15:56:28 +0000 [thread overview]
Message-ID: <20261016155628.GA3947801@google.com> (raw)
In-Reply-To: <20261016-fix-qce-ccm-adata-leak-v1-0-f54a82af2de0@uniontech.com>
On Fri, Oct 16, 2026 at 10:09:42AM +0800, ZhaoJinming wrote:
> This series fixes a memory leak in the QCE AEAD driver together with two
> bugs in the error handling around it.
>
> qce_aead_ccm_prepare_buf_assoclen() allocates rctx->adata for every CCM
> request that carries associated data, but the buffer is never freed.
>
> While preparing that fix, two problems in the error path of
> qce_aead_async_req_handle() turned out to matter:
>
> - It unmaps req->src although rctx->src_sg is the scatterlist that was
> passed to dma_map_sg(). For CCM requests with associated data,
> rctx->src_sg carries the AAD buffer, so its mapping is leaked, and
> freeing rctx->adata there would free memory that is still DMA-mapped.
>
> - A dma_map_sg() failure for the source scatterlist is not detected,
> because the result is checked for a negative value while
> dma_map_sg() returns 0 on failure. The error path then unmaps a
> scatterlist that was never mapped.
>
> Patch 1 unmaps the correct scatterlist, patch 2 adds the missing frees
> and patch 3 fixes the dma_map_sg() check.
>
> All three were reported as pre-existing in the Sashiko review of the QCE
> BAM locking series. They touch the same function that was recently fixed
> by commit 7f2345f47dd1 ("crypto: qce - fix CCM AAD buffer
> underallocation").
Note that I reported these bugs (and others still unfixed) 3 months ago:
https://lore.kernel.org/linux-crypto/20260723183438.GB93534@quark/
- Eric
prev parent reply other threads:[~2026-10-16 15:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 2:09 [PATCH 0/3] crypto: qce - fix CCM AAD buffer leak and the AEAD error paths ZhaoJinming
2026-10-16 2:09 ` [PATCH 1/3] crypto: qce - unmap the correct scatterlist in the CCM error path ZhaoJinming
2026-10-16 2:09 ` [PATCH 2/3] crypto: qce - fix memory leak of the CCM AAD buffer ZhaoJinming
2026-10-16 2:09 ` [PATCH 3/3] crypto: qce - check dma_map_sg() result for the source scatterlist ZhaoJinming
2026-10-16 13:40 ` [PATCH 0/3] crypto: qce - fix CCM AAD buffer leak and the AEAD error paths Bartosz Golaszewski
2026-10-16 15:56 ` Eric Biggers [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=20261016155628.GA3947801@google.com \
--to=ebiggers@kernel.org \
--cc=brgl@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=thara.gopinath@linaro.org \
--cc=zhaojinming@uniontech.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.