Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Suyuan Wang via B4 Relay <devnull+shyckless.gmail.com@kernel.org>
To: clabbe@baylibre.com, heiko@sntech.de,
	herbert@gondor.apana.org.au,  davem@davemloft.net
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-crypto@vger.kernel.org,
	linux-rockchip@lists.infradead.org
Subject: [PATCH] crypto: rockchip - Drop the runtime PM reference on DMA mapping errors
Date: Tue, 24 Nov 2026 04:41:48 +0000	[thread overview]
Message-ID: <20261124-rk-crypto-v1-1-8fb89152fac0@gmail.com> (raw)

From: Suyuan Wang <stevewong@hust.edu.cn>

rk_cipher_run() takes a runtime PM reference with
pm_runtime_resume_and_get() at the start of every request. The normal
exit path drops it again at the theend label.

If dma_map_sg() fails, the function jumps to theend_sgs or theend_iv
and returns the error without calling pm_runtime_put_autosuspend().
Each such request leaves one usage count behind, so the device can no
longer runtime suspend.

Drop the reference on this error path too.

Found with a static analysis tool and checked by hand.

Fixes: 9dcd71c863a6 ("crypto: rockchip - Add support for RK3399")
Cc: stable@vger.kernel.org
Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
---
Compile tested on arm64 (W=1). I don't have the hardware.
---
 drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/rockchip/rk3288_crypto_skcipher.c b/drivers/crypto/rockchip/rk3288_crypto_skcipher.c
index e80f9148c012..3f285175a194 100644
--- a/drivers/crypto/rockchip/rk3288_crypto_skcipher.c
+++ b/drivers/crypto/rockchip/rk3288_crypto_skcipher.c
@@ -427,6 +427,7 @@ static int rk_cipher_run(struct crypto_engine *engine, void *async_req)
 		dma_unmap_sg(rkc->dev, sgd, 1, DMA_FROM_DEVICE);
 	}
 theend_iv:
+	pm_runtime_put_autosuspend(rkc->dev);
 	return err;
 }
 






                 reply	other threads:[~2026-11-24  4:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261124-rk-crypto-v1-1-8fb89152fac0@gmail.com \
    --to=devnull+shyckless.gmail.com@kernel.org \
    --cc=clabbe@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=heiko@sntech.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=shyckless@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox