From: sashiko-bot@kernel.org
To: "Vinicius Costa Gomes" <vinicius.gomes@intel.com>
Cc: Frank.Li@kernel.org, vkoul@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v2 2/5] crypto: iaa - fall back to software for multi-entry scatterlists
Date: Wed, 05 Aug 2026 21:38:40 +0000 [thread overview]
Message-ID: <20260805213841.5CA701F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260805-iaa-crypto-fixes-zswap-v2-2-55c02694f499@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Software decompression fallback reads and writes buffers while they are still DMA-mapped, leading to data corruption on systems using SWIOTLB (bounce buffers).
--
--- Patch [2]: [PATCH v2 2/5] crypto: iaa - fall back to software for multi-entry scatterlists ---
commit 6596711a82477095464512f0a5cfb3f894ac8fad
Author: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Subject: crypto: iaa - fall back to software for multi-entry scatterlists
This commit routes multi-entry scatterlists to a software deflate
implementation instead of failing them. It simplifies the DMA mapping
paths to handle only single entries and falls back to software on mapping
failures. Counters are added to track the number of software fallback
compressions.
Cc: stable@vger.kernel.org
> diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/intel/iaa/iaa_crypto_main.c
> index f62b994e18e58..904d9413ba182 100644
> --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c
> +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c
[ ... ]
> @@ -1639,10 +1650,8 @@ static int iaa_comp_adecompress(struct acomp_req *req)
> if (ret != 0)
> dev_dbg(dev, "asynchronous decompress failed ret=%d\n", ret);
>
> - dma_unmap_sg(dev, req->dst, sg_nents(req->dst), DMA_FROM_DEVICE);
> -err_map_dst:
> - dma_unmap_sg(dev, req->src, sg_nents(req->src), DMA_TO_DEVICE);
> -out:
> + dma_unmap_sg(dev, req->dst, 1, DMA_FROM_DEVICE);
> + dma_unmap_sg(dev, req->src, 1, DMA_TO_DEVICE);
> iaa_wq_put(wq);
>
> return ret;
[Severity: High]
This is a pre-existing issue, but can the software fallback logic corrupt
data on systems using SWIOTLB (bounce buffers)?
If hardware decompression fails with an analytics error (for example,
IAA_ANALYTICS_ERROR), the driver falls back to software decompression via
deflate_generic_decompress(). This fallback executes directly on the CPU,
modifying the original virtual pages.
In the async completion path, the software fallback is executed while the
buffers are still actively DMA-mapped:
iaa_crypto_main.c:iaa_desc_complete() {
...
if (err == IAA_ANALYTICS_ERROR) {
ret = deflate_generic_decompress(ctx->req);
...
dma_unmap_sg(dev, req->dst, 1, DMA_FROM_DEVICE);
}
When SWIOTLB is active, this unmap operation syncs the bounce buffer back
to the original memory. Does this completely overwrite the correct data just
produced by the software fallback with stale hardware garbage?
Could the driver unmap the buffers before falling back to software
decompression to prevent this?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260805-iaa-crypto-fixes-zswap-v2-0-55c02694f499@intel.com?part=2
next prev parent reply other threads:[~2026-08-05 21:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 21:19 [PATCH v2 0/5] crypto: iaa - Fixes for multi entry SG lists Vinicius Costa Gomes
2026-08-05 21:19 ` [PATCH v2 1/5] dmaengine: idxd: assign all engines to group 0 in IAA defaults Vinicius Costa Gomes
2026-08-05 21:41 ` sashiko-bot
2026-08-05 21:19 ` [PATCH v2 2/5] crypto: iaa - fall back to software for multi-entry scatterlists Vinicius Costa Gomes
2026-08-05 21:38 ` sashiko-bot [this message]
2026-08-05 21:19 ` [PATCH v2 3/5] crypto: iaa - avoid counting fallback decompression bytes Vinicius Costa Gomes
2026-08-05 21:32 ` sashiko-bot
2026-08-05 21:19 ` [PATCH v2 4/5] crypto: iaa - use bounce buffer for multi-sg decompress input Vinicius Costa Gomes
2026-08-05 21:36 ` sashiko-bot
2026-08-05 21:19 ` [PATCH v2 5/5] crypto: iaa - unmap dst before software fallback on decompress Vinicius Costa Gomes
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=20260805213841.5CA701F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vinicius.gomes@intel.com \
--cc=vkoul@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