Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pavitrakumar Managutte" <pavitrakumarm@vayavyalabs.com>,
	linux-crypto@vger.kernel.org, devicetree@vger.kernel.org,
	herbert@gondor.apana.org.au, robh@kernel.org
Cc: krzk@kernel.org, conor+dt@kernel.org, ruud.derwig@gf.com,
	rbannerm@synopsys.com, manjunath.hadli@vayavyalabs.com,
	adityak@vayavyalabs.com, navami.telsang@vayavyalabs.com,
	bhoomikak@vayavyalabs.com, nazim.khan@vayavyalabs.com
Subject: Re: [PATCH v30 4/4] crypto: spacc - Add SPAcc Kconfig and Makefile
Date: Wed, 18 Nov 2026 07:02:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-220283@kernel.org> (raw)
In-Reply-To: <20261118063504.835259-5-pavitrakumarm@vayavyalabs.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] crypto: spacc: DMA buffer and DDT leak in
  spacc_xof_stringsize_autodetect()
--

commit 7f28b560104fe0765e17ef1a3786eb35ead09c4e
Author: Pavitrakumar Managutte <pavitrakumarm@vayavyalabs.com>

crypto: spacc - Add SPAcc Kconfig and Makefile

This commit adds the Kconfig and Makefile for the Synopsys DesignWare SPAcc
driver and hooks it into the crypto subsystem build.

[ ... ]

> diff --git a/drivers/crypto/dwc-spacc/Makefile b/drivers/crypto/dwc-spacc/Makefile
> new file mode 100644
> index 0000000000000..b7125a7797ba0
> --- /dev/null
> +++ b/drivers/crypto/dwc-spacc/Makefile
> @@ -0,0 +1,7 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +obj-$(CONFIG_CRYPTO_DEV_SPACC) += snps-spacc.o
> +
> +snps-spacc-y := spacc_hal.o spacc_core.o \
> +spacc_manager.o spacc_interrupt.o spacc_device.o

[Severity: Medium]
Does the err_timeout path in spacc_xof_stringsize_autodetect() leak the
coherent DMA buffer virt and the DDT entry ddt?

drivers/crypto/dwc-spacc/spacc_core.c:spacc_xof_stringsize_autodetect() {
	...
	virt = dma_alloc_coherent(spacc->dptr, SPACC_TEST_DMA_BUFF_SIZE,
				  &dma, GFP_KERNEL);
	...
	if (pdu_ddt_init(spacc->dptr, &ddt, 1)) {
		kfree(buf);
		dma_free_coherent(spacc->dptr, SPACC_TEST_DMA_BUFF_SIZE,
				  virt, dma);
		return -EIO;
	}
	...
			ret = spacc_wait_for_job_completion(spacc, virt,
							    md[alg], &match);
			if (ret)
				goto err_timeout;
	...
	kfree(buf);
	pdu_ddt_free(&ddt);
	dma_free_coherent(spacc->dptr, SPACC_TEST_DMA_BUFF_SIZE,
			  virt, dma);

	return spacc->config.string_size ? 0 : -ENODEV;

err_timeout:
	dev_err(spacc->dptr,
		"XOF autodetect job timed out, engine not responding\n");
	kfree(buf);
	return -ETIMEDOUT;
}

When spacc_wait_for_job_completion() times out during spacc_init(),
err_timeout only frees buf, omitting pdu_ddt_free(&ddt),
dma_free_coherent(), and the register cleanup done on the normal exit path.
The error unwind in spacc_init_device() then calls pdu_mem_deinit(), which
calls dma_pool_destroy(priv->ddt4_pool) while ddt.virt is still allocated
from that pool.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118063504.835259-1-pavitrakumarm@vayavyalabs.com?part=4

      reply	other threads:[~2026-11-18  7:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  6:35 [PATCH v30 0/4] crypto: spacc - Add SPAcc Crypto Driver Pavitrakumar Managutte
2026-11-18  6:35 ` [PATCH v30 1/4] dt-bindings: crypto: Document support for SPAcc Pavitrakumar Managutte
2026-11-18  6:35 ` [PATCH v30 2/4] crypto: spacc - Add SPAcc ahash support Pavitrakumar Managutte
2026-11-18  6:59   ` sashiko-bot
2026-11-18  6:35 ` [PATCH v30 3/4] crypto: spacc - add spacc autodetect support Pavitrakumar Managutte
2026-11-18  6:35 ` [PATCH v30 4/4] crypto: spacc - Add SPAcc Kconfig and Makefile Pavitrakumar Managutte
2026-11-18  7:02   ` 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=sashiko-outbox-220283@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=adityak@vayavyalabs.com \
    --cc=bhoomikak@vayavyalabs.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=krzk@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=manjunath.hadli@vayavyalabs.com \
    --cc=navami.telsang@vayavyalabs.com \
    --cc=nazim.khan@vayavyalabs.com \
    --cc=pavitrakumarm@vayavyalabs.com \
    --cc=rbannerm@synopsys.com \
    --cc=robh@kernel.org \
    --cc=ruud.derwig@gf.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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