]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: tegra - fix refcount leak in tegra_se_host1x_submit()
authorWentao Liang <vulab@iscas.ac.cn>
Thu, 4 Jun 2026 10:27:06 +0000 (10:27 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Jun 2026 01:56:45 +0000 (09:56 +0800)
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>
Reviewed-by: Akhil R <akhilrajeev@nvidia.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/tegra/tegra-se-main.c

index d7541a9c0a92341921c862a8bbc6276d62e8b23b..d2f518ef9a103fea73edfd8d307519e9a22162eb 100644 (file)
@@ -179,7 +179,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);