Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] crypto: Remove redundant error messages on IRQ request failure
@ 2026-07-17  8:00 Pan Chuang
  2026-07-17  8:00 ` [PATCH 02/12] crypto: amlogic - Remove redundant dev_err() Pan Chuang
  0 siblings, 1 reply; 3+ messages in thread
From: Pan Chuang @ 2026-07-17  8:00 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S. Miller, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Neal Liu, Joel Stanley,
	Andrew Jeffery, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Horia Geantă, Pankaj Gupta, Gaurav Jain, Gilad Ben-Yossef,
	Hans Ulli Kroll, Linus Walleij, Antoine Tenart, Prabhjot Khurana,
	Declan Murphy, Srujana Challa, Bharat Bhushan, Frank Li,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Heiko Stuebner, Maxime Coquelin, Alexandre Torgue, Ovidiu Panait,
	Arnd Bergmann, Eric Biggers, Pan Chuang, Myeonghun Pak, Ijae Kim,
	Krzysztof Kozlowski, Kees Cook, Thorsten Blum, Colin Ian King,
	Sakari Ailus, open list:ALLWINNER CRYPTO DRIVERS,
	moderated list:ARM/Allwinner sunXi SoC support,
	open list:ARM/Allwinner sunXi SoC support, open list,
	open list:ARM/Amlogic Meson SoC Crypto Drivers,
	moderated list:ASPEED CRYPTO DRIVER,
	open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	open list:ARM/Rockchip SoC support,
	moderated list:ARM/STM32 ARCHITECTURE

Commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()") added automatic error logging to
devm_request_threaded_irq() and devm_request_any_context_irq()
via the new devm_request_result() helper, which prints device
name, IRQ number, handler functions, and error code on failure.

Since devm_request_irq() is a static inline wrapper around
devm_request_threaded_irq(), it also benefits from this
automatic logging.

Remove the now-redundant dev_err() and dev_err_probe() calls
in crypto drivers that follow these devm_request_*_irq()
functions, as the core now provides more detailed diagnostic
information on failure.

Pan Chuang (12):
  crypto: allwinner - Remove redundant dev_err()
  crypto: amlogic - Remove redundant dev_err()
  crypto: aspeed - Remove redundant dev_err()
  crypto: Remove redundant dev_err()/dev_err_probe()
  crypto: caam - Remove redundant dev_err()
  crypto: ccree - Remove redundant dev_err()
  crypto: sl3516 - Remove redundant dev_err()
  crypto: safexcel - Remove redundant dev_err()
  crypto: keembay - Remove redundant dev_err()
  crypto: octeontx2 - Remove redundant dev_err()
  crypto: rockchip - Remove redundant dev_err()
  crypto: stm32 - Remove redundant dev_err()

 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c   | 4 +---
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c   | 4 +---
 drivers/crypto/amlogic/amlogic-gxl-core.c           | 4 +---
 drivers/crypto/aspeed/aspeed-acry.c                 | 4 +---
 drivers/crypto/aspeed/aspeed-hace.c                 | 4 +---
 drivers/crypto/atmel-aes.c                          | 4 +---
 drivers/crypto/atmel-sha.c                          | 4 +---
 drivers/crypto/atmel-tdes.c                         | 4 +---
 drivers/crypto/caam/jr.c                            | 2 --
 drivers/crypto/ccree/cc_driver.c                    | 4 +---
 drivers/crypto/gemini/sl3516-ce-core.c              | 4 +---
 drivers/crypto/img-hash.c                           | 4 +---
 drivers/crypto/inside-secure/safexcel.c             | 4 +---
 drivers/crypto/intel/keembay/keembay-ocs-aes-core.c | 4 +---
 drivers/crypto/intel/keembay/keembay-ocs-ecc.c      | 4 +---
 drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c | 4 +---
 drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c  | 5 +----
 drivers/crypto/mxs-dcp.c                            | 8 ++------
 drivers/crypto/omap-aes.c                           | 4 +---
 drivers/crypto/omap-des.c                           | 4 +---
 drivers/crypto/omap-sham.c                          | 5 +----
 drivers/crypto/rockchip/rk3288_crypto.c             | 4 +---
 drivers/crypto/sahara.c                             | 3 +--
 drivers/crypto/stm32/stm32-cryp.c                   | 4 +---
 drivers/crypto/stm32/stm32-hash.c                   | 4 +---
 25 files changed, 25 insertions(+), 78 deletions(-)

-- 
2.34.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 02/12] crypto: amlogic - Remove redundant dev_err()
  2026-07-17  8:00 [PATCH 00/12] crypto: Remove redundant error messages on IRQ request failure Pan Chuang
@ 2026-07-17  8:00 ` Pan Chuang
  2026-07-17  8:12   ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Pan Chuang @ 2026-07-17  8:00 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S. Miller,
	open list:ARM/Amlogic Meson SoC Crypto Drivers,
	open list:ARM/Amlogic Meson SoC Crypto Drivers, open list
  Cc: Pan Chuang

Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
---
 drivers/crypto/amlogic/amlogic-gxl-core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c
index 6cb33949915f..169c6eeb51e5 100644
--- a/drivers/crypto/amlogic/amlogic-gxl-core.c
+++ b/drivers/crypto/amlogic/amlogic-gxl-core.c
@@ -257,10 +257,8 @@ static int meson_crypto_probe(struct platform_device *pdev)
 
 		err = devm_request_irq(&pdev->dev, mc->irqs[i], meson_irq_handler, 0,
 				       "gxl-crypto", mc);
-		if (err < 0) {
-			dev_err(mc->dev, "Cannot request IRQ for flow %d\n", i);
+		if (err < 0)
 			return err;
-		}
 	}
 
 	err = clk_prepare_enable(mc->busclk);
-- 
2.34.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 02/12] crypto: amlogic - Remove redundant dev_err()
  2026-07-17  8:00 ` [PATCH 02/12] crypto: amlogic - Remove redundant dev_err() Pan Chuang
@ 2026-07-17  8:12   ` sashiko-bot
  0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-07-17  8:12 UTC (permalink / raw)
  To: Pan Chuang; +Cc: neil.armstrong, linux-amlogic

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

Pre-existing issues:
- [High] IRQs are requested via devm_request_irq before the device clock is enabled and the channel list is allocated.
- [High] The driver modifies a shared static global array of algorithm templates during probe, preventing multiple device instances and corrupting crypto API state.
- [High] DMA mappings are leaked in `meson_cipher` when scatterlist mapping fails or exceeds the maximum descriptor count.
- [Medium] The IRQ handler unconditionally returns IRQ_HANDLED even for spurious interrupts.
--

--- Patch [2]: [PATCH 02/12] crypto: amlogic - Remove redundant dev_err() ---
commit 82c5002d2a0028a21e2688dd2106e4d410487f9e
Author: Pan Chuang <panchuang@vivo.com>

crypto: amlogic - Remove redundant dev_err()

Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

> diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c
> index 6cb33949915fe..169c6eeb51e51 100644
> --- a/drivers/crypto/amlogic/amlogic-gxl-core.c
> +++ b/drivers/crypto/amlogic/amlogic-gxl-core.c
> @@ -257,10 +257,8 @@ static int meson_crypto_probe(struct platform_device *pdev)
>  
>  		err = devm_request_irq(&pdev->dev, mc->irqs[i], meson_irq_handler, 0,
>  				       "gxl-crypto", mc);
> -		if (err < 0) {
> -			dev_err(mc->dev, "Cannot request IRQ for flow %d\n", i);
> +		if (err < 0)
>  			return err;

[Severity: High]
This is a pre-existing issue, but does requesting the interrupt at this point
risk a crash if an interrupt fires immediately?

If an interrupt fires between devm_request_irq() and the subsequent calls to
clk_prepare_enable() or meson_allocate_chanlist(), the handler will run before
resources are initialized.

In drivers/crypto/amlogic/amlogic-gxl-core.c:meson_irq_handler():

    p = readl(mc->base + ((0x04 + flow) << 2));
    if (p) {
        writel_relaxed(0xF, mc->base + ((0x4 + flow) << 2));
        mc->chanlist[flow].status = 1;

The handler performs a readl() on unclocked device registers, which can cause
a synchronous external abort or bus hang. It also accesses mc->chanlist
without checking if it is allocated, which could cause a null pointer
dereference.

[Severity: Medium]
This is a pre-existing issue, but does meson_irq_handler() unconditionally
return IRQ_HANDLED even for spurious interrupts?

Looking at drivers/crypto/amlogic/amlogic-gxl-core.c:meson_irq_handler():

    dev_err(mc->dev, "%s %d from unknown irq\n", __func__, irq);
    return IRQ_HANDLED;

If an unhandled interrupt occurs, returning IRQ_HANDLED prevents the core
interrupt subsystem's "nobody cared" logic from disabling a stuck interrupt
line. Could this result in an interrupt storm locking up a processor if the
hardware malfunctions?

> -		}
>  	}
>  
>  	err = clk_prepare_enable(mc->busclk);

[Severity: High]
This is a pre-existing issue, but does the driver modify a shared static
global array during probe?

Looking at meson_register_algs() which is called shortly after in
meson_crypto_probe():

In drivers/crypto/amlogic/amlogic-gxl-core.c:meson_register_algs():

    mc_algs[i].mc = mc;
    switch (mc_algs[i].type) {
    case CRYPTO_ALG_TYPE_SKCIPHER:
        err = crypto_engine_register_skcipher(&mc_algs[i].alg.skcipher);

Modifying the shared global static array mc_algs with device-specific pointers
prevents multiple device instances from functioning correctly. Probing multiple
instances or unbinding and rebinding the device will mutate this shared state,
which might corrupt the linked lists within the kernel's crypto subsystem.

[Severity: High]
This is a pre-existing issue, but does meson_cipher() leak direct memory access
mappings when scatterlist mapping fails?

In drivers/crypto/amlogic/amlogic-gxl-cipher.c:meson_cipher():

    if (!nr_sgs || nr_sgs > MAXDESC - 3) {
        dev_err(mc->dev, "Invalid SG count %d\n", nr_sgs);
        err = -EINVAL;
        goto theend;
    }

And in the error path:

    theend:
        kfree_sensitive(bkeyiv);
        kfree_sensitive(backup_iv);

        return err;

The error path frees memory but does not call dma_unmap_single() for the
previously mapped phykeyiv, nor dma_unmap_sg() for the already mapped
areq->src. Can this permanently leak mapping resources until exhaustion if
fragmented scatterlists are submitted?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260717080045.191538-1-panchuang@vivo.com?part=2

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-17  8:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17  8:00 [PATCH 00/12] crypto: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-17  8:00 ` [PATCH 02/12] crypto: amlogic - Remove redundant dev_err() Pan Chuang
2026-07-17  8:12   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox