mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: tegra: fix refcount leak in tegra_se_host1x_submit()
@ 2026-06-04 10:27 Wentao Liang
  2026-06-05  5:34 ` Akhil R
  2026-06-11  8:55 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-06-04 10:27 UTC (permalink / raw)
  To: akhilrajeev, herbert, davem, thierry.reding, jonathanh
  Cc: linux-crypto, linux-tegra, linux-kernel, Wentao Liang, stable

The timeout error path in tegra_se_host1x_submit() returns without
calling host1x_job_put(), while all other paths (success, submit
error, pin error) properly release the job reference through the
job_put label.  Since host1x_job_alloc() initializes the reference
count and host1x_job_put() is required to drop it, omitting it on
timeout causes a permanent refcount leak.

Fix this by redirecting the timeout return to the existing job_put
label, ensuring the job reference and any associated syncpt
references are consistently released.

Cc: stable@vger.kernel.org
Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/crypto/tegra/tegra-se-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/tegra/tegra-se-main.c b/drivers/crypto/tegra/tegra-se-main.c
index eb71113ed146..e8d8c3a23d7a 100644
--- a/drivers/crypto/tegra/tegra-se-main.c
+++ b/drivers/crypto/tegra/tegra-se-main.c
@@ -180,7 +180,7 @@ int tegra_se_host1x_submit(struct tegra_se *se, struct tegra_se_cmdbuf *cmdbuf,
 				 MAX_SCHEDULE_TIMEOUT, NULL);
 	if (ret) {
 		dev_err(se->dev, "host1x job timed out\n");
-		return ret;
+		goto job_put;
 	}
 
 	host1x_job_put(job);
-- 
2.34.1


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

* Re: [PATCH] crypto: tegra: fix refcount leak in tegra_se_host1x_submit()
  2026-06-04 10:27 [PATCH] crypto: tegra: fix refcount leak in tegra_se_host1x_submit() Wentao Liang
@ 2026-06-05  5:34 ` Akhil R
  2026-06-11  8:55 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Akhil R @ 2026-06-05  5:34 UTC (permalink / raw)
  To: vulab
  Cc: akhilrajeev, davem, herbert, jonathanh, linux-crypto,
	linux-kernel, linux-tegra, stable, thierry.reding

On Thu, 4 Jun 2026 10:27:06 +0000, Wentao Liang wrote:
> The timeout error path in tegra_se_host1x_submit() returns without
> calling host1x_job_put(), while all other paths (success, submit
> error, pin error) properly release the job reference through the
> job_put label.  Since host1x_job_alloc() initializes the reference
> count and host1x_job_put() is required to drop it, omitting it on
> timeout causes a permanent refcount leak.
> 
> Fix this by redirecting the timeout return to the existing job_put
> label, ensuring the job reference and any associated syncpt
> references are consistently released.
> 
> Cc: stable@vger.kernel.org
> Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver")
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

Thanks for the patch.

Reviewed-by: Akhil R <akhilrajeev@nvidia.com>

Best Regards,
Akhil

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

* Re: [PATCH] crypto: tegra: fix refcount leak in tegra_se_host1x_submit()
  2026-06-04 10:27 [PATCH] crypto: tegra: fix refcount leak in tegra_se_host1x_submit() Wentao Liang
  2026-06-05  5:34 ` Akhil R
@ 2026-06-11  8:55 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2026-06-11  8:55 UTC (permalink / raw)
  To: Wentao Liang
  Cc: akhilrajeev, davem, thierry.reding, jonathanh, linux-crypto,
	linux-tegra, linux-kernel, stable

On Thu, Jun 04, 2026 at 10:27:06AM +0000, Wentao Liang wrote:
> The timeout error path in tegra_se_host1x_submit() returns without
> calling host1x_job_put(), while all other paths (success, submit
> error, pin error) properly release the job reference through the
> job_put label.  Since host1x_job_alloc() initializes the reference
> count and host1x_job_put() is required to drop it, omitting it on
> timeout causes a permanent refcount leak.
> 
> Fix this by redirecting the timeout return to the existing job_put
> label, ensuring the job reference and any associated syncpt
> references are consistently released.
> 
> Cc: stable@vger.kernel.org
> Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver")
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/crypto/tegra/tegra-se-main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2026-06-11  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-04 10:27 [PATCH] crypto: tegra: fix refcount leak in tegra_se_host1x_submit() Wentao Liang
2026-06-05  5:34 ` Akhil R
2026-06-11  8:55 ` Herbert Xu

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

all inboxes | Powered by JetHome®