From: sashiko-bot@kernel.org
To: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v23 14/14] crypto: qce - Communicate the base physical address to the dmaengine
Date: Tue, 21 Jul 2026 13:55:53 +0000 [thread overview]
Message-ID: <20260721135554.4DE261F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260721-qcom-qce-cmd-descr-v23-14-1be02deffda9@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Unintended hardware misconfiguration due to partially initialized `dma_slave_config`.
- [Medium] Potential memory leak in qce_submit_cmd_desc() error path because dmaengine_desc_free() refuses to free non-reusable descriptors.
--
--- Patch [14]: [PATCH v23 14/14] crypto: qce - Communicate the base physical address to the dmaengine ---
commit 6c1591ac036f81ee86f8eab63457a3de06d13cef
Author: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
crypto: qce - Communicate the base physical address to the dmaengine
This patch configures the BAM DMA engine with the base physical address
to be used as a scratchpad for dummy writes related to BAM pipe locking.
It passes the peripheral configuration structure to the DMA driver via
dmaengine_slave_config().
> diff --git a/drivers/crypto/qce/dma.c b/drivers/crypto/qce/dma.c
> index 88d253d9147cf..09699d96575b1 100644
> --- a/drivers/crypto/qce/dma.c
> +++ b/drivers/crypto/qce/dma.c
> @@ -116,8 +117,16 @@ static void qce_dma_terminate(void *data)
>
> int devm_qce_dma_request(struct qce_device *qce)
> {
> + struct bam_config peripheral_cfg = {
> + .lock_scratchpad_addr = (u32)qce->base_phys + REG_VERSION,
> + };
> + struct dma_slave_config cfg = {
> + .direction = DMA_MEM_TO_DEV,
> + .peripheral_config = &peripheral_cfg,
> + };
[Severity: Medium]
Does this partially initialized dma_slave_config cause an unintended
hardware misconfiguration?
By only setting the direction and peripheral_config, the designated
initializer silently zeroes out src_maxburst and dst_maxburst.
When dmaengine_slave_config() is called, the BAM DMA driver copies this
configuration. Later, if the engine is not remotely controlled, it will
write this zeroed maxburst value to the hardware threshold register:
drivers/dma/qcom/bam_dma.c:bam_apply_new_config() {
...
if (dir == DMA_DEV_TO_MEM)
maxburst = bchan->slave.src_maxburst;
else
maxburst = bchan->slave.dst_maxburst;
writel_relaxed(maxburst,
bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
...
}
This alters the hardware configuration from its default (4) and might
break DMA interrupt generation or cause an interrupt storm on systems
where the BAM is natively configured.
[ ... ]
Also, there is a second issue I'd like to ask about regarding
qce_submit_cmd_desc():
[Severity: Medium]
Can this error path leak the DMA descriptor?
In qce_submit_cmd_desc(), the code calls dmaengine_prep_slave_sg() with
attrs = DMA_PREP_CMD but lacks the DMA_CTRL_REUSE flag. If
dma_submit_error() detects an error, it branches to err_free_desc:
drivers/crypto/qce/dma.c:qce_submit_cmd_desc() {
...
err_free_desc:
dmaengine_desc_free(dma_desc);
...
}
Because the descriptor was not prepared with DMA_CTRL_REUSE,
dmaengine_desc_free() will immediately return -EPERM without freeing the
descriptor.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260721-qcom-qce-cmd-descr-v23-0-1be02deffda9@oss.qualcomm.com?part=14
prev parent reply other threads:[~2026-07-21 13:55 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 13:33 [PATCH v23 00/14] crypto/dmaengine: qce: introduce BAM locking and use DMA for register I/O Bartosz Golaszewski
2026-07-21 13:33 ` [PATCH v23 01/14] dmaengine: constify struct dma_descriptor_metadata_ops Bartosz Golaszewski
2026-07-21 13:33 ` [PATCH v23 02/14] dmaengine: qcom: bam_dma: free interrupt before the clock in error path Bartosz Golaszewski
2026-07-21 13:48 ` sashiko-bot
2026-07-21 13:33 ` [PATCH v23 03/14] dmaengine: qcom: bam_dma: convert tasklet to a BH workqueue Bartosz Golaszewski
2026-07-21 13:52 ` sashiko-bot
2026-07-21 13:33 ` [PATCH v23 04/14] dmaengine: qcom: bam_dma: Extend the driver's device match data Bartosz Golaszewski
2026-07-21 13:33 ` [PATCH v23 05/14] dmaengine: qcom: bam_dma: Add pipe_lock_supported flag support Bartosz Golaszewski
2026-07-21 13:45 ` sashiko-bot
2026-07-21 13:33 ` [PATCH v23 06/14] dmaengine: qcom: bam_dma: add support for BAM locking Bartosz Golaszewski
2026-07-21 13:48 ` sashiko-bot
2026-07-22 8:59 ` Stephan Gerhold
2026-07-22 9:34 ` Bartosz Golaszewski
2026-07-22 12:47 ` Stephan Gerhold
2026-07-21 18:07 ` Mukesh Savaliya
2026-07-21 13:33 ` [PATCH v23 07/14] crypto: qce - Cancel work on device detach Bartosz Golaszewski
2026-07-21 13:47 ` sashiko-bot
2026-07-21 13:33 ` [PATCH v23 08/14] crypto: qce - Include algapi.h in the core.h header Bartosz Golaszewski
2026-07-21 13:33 ` [PATCH v23 09/14] crypto: qce - Remove unused ignore_buf Bartosz Golaszewski
2026-07-21 13:46 ` sashiko-bot
2026-07-21 13:33 ` [PATCH v23 10/14] crypto: qce - Simplify arguments of devm_qce_dma_request() Bartosz Golaszewski
2026-07-21 13:44 ` sashiko-bot
2026-07-21 13:33 ` [PATCH v23 11/14] crypto: qce - Use existing devres APIs in devm_qce_dma_request() Bartosz Golaszewski
2026-07-21 13:47 ` sashiko-bot
2026-07-21 18:16 ` Mukesh Savaliya
2026-07-21 13:33 ` [PATCH v23 12/14] crypto: qce - Map crypto memory for DMA Bartosz Golaszewski
2026-07-21 13:48 ` sashiko-bot
2026-07-21 18:20 ` Mukesh Savaliya
2026-07-22 9:17 ` Bartosz Golaszewski
2026-07-21 13:33 ` [PATCH v23 13/14] crypto: qce - Add BAM DMA support for crypto register I/O Bartosz Golaszewski
2026-07-21 13:50 ` sashiko-bot
2026-07-21 13:33 ` [PATCH v23 14/14] crypto: qce - Communicate the base physical address to the dmaengine Bartosz Golaszewski
2026-07-21 13:55 ` sashiko-bot [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=20260721135554.4DE261F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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 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.