The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/4] accel/rocket: resource leak and stability improvements
@ 2026-08-14  2:24 Chaoyi Chen
  2026-08-14  2:24 ` [PATCH 1/4] accel/rocket: Fix the IOMMU domain leak in rocket_ioctl_create_bo Chaoyi Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chaoyi Chen @ 2026-08-14  2:24 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay, Heiko Stuebner, Jeff Hugo
  Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel,
	Chaoyi Chen

From: Chaoyi Chen <chaoyi.chen@rock-chips.com>

Hi,

This series fixes rocket driver handling on certain error paths to
avoid unexpected resource leaks and panics.

Chaoyi Chen (4):
  accel/rocket: Fix the IOMMU domain leak in rocket_ioctl_create_bo
  accel/rocket: Fix the panic in rocket_iommu_domain_put when the domain
    is NULL
  accel/rocket: Fix the extra iommu_group_get call in
    rocket_job_handle_irq
  MAINTAINERS: accel/rocket: Add rockchip mail list for rocket

 MAINTAINERS                       | 1 +
 drivers/accel/rocket/rocket_drv.c | 3 ++-
 drivers/accel/rocket/rocket_gem.c | 2 ++
 drivers/accel/rocket/rocket_job.c | 2 +-
 4 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.53.0


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

* [PATCH 1/4] accel/rocket: Fix the IOMMU domain leak in rocket_ioctl_create_bo
  2026-08-14  2:24 [PATCH 0/4] accel/rocket: resource leak and stability improvements Chaoyi Chen
@ 2026-08-14  2:24 ` Chaoyi Chen
  2026-08-14  2:24 ` [PATCH 2/4] accel/rocket: Fix the panic in rocket_iommu_domain_put when the domain is NULL Chaoyi Chen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyi Chen @ 2026-08-14  2:24 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay, Heiko Stuebner, Jeff Hugo
  Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel,
	Chaoyi Chen

From: Chaoyi Chen <chaoyi.chen@rock-chips.com>

When rocket_ioctl_create_bo fails, rocket_iommu_domain_put should be
called to avoid an IOMMU domain leak.

Fixes: 658ebeac3351 ("accel/rocket: Add IOCTL for BO creation")
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
---
 drivers/accel/rocket/rocket_gem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
index a5fffa51ff35..438694ba567b 100644
--- a/drivers/accel/rocket/rocket_gem.c
+++ b/drivers/accel/rocket/rocket_gem.c
@@ -127,6 +127,8 @@ int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *
 	mutex_unlock(&rocket_priv->mm_lock);
 
 err:
+	rocket_iommu_domain_put(rkt_obj->domain);
+	rkt_obj->domain = NULL;
 	drm_gem_shmem_object_free(gem_obj);
 
 	return ret;
-- 
2.53.0


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

* [PATCH 2/4] accel/rocket: Fix the panic in rocket_iommu_domain_put when the domain is NULL
  2026-08-14  2:24 [PATCH 0/4] accel/rocket: resource leak and stability improvements Chaoyi Chen
  2026-08-14  2:24 ` [PATCH 1/4] accel/rocket: Fix the IOMMU domain leak in rocket_ioctl_create_bo Chaoyi Chen
@ 2026-08-14  2:24 ` Chaoyi Chen
  2026-08-14  2:24 ` [PATCH 3/4] accel/rocket: Fix the extra iommu_group_get call in rocket_job_handle_irq Chaoyi Chen
  2026-08-14  2:24 ` [PATCH 4/4] MAINTAINERS: accel/rocket: Add rockchip mail list for rocket Chaoyi Chen
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyi Chen @ 2026-08-14  2:24 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay, Heiko Stuebner, Jeff Hugo
  Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel,
	Chaoyi Chen

From: Chaoyi Chen <chaoyi.chen@rock-chips.com>

In rocket_ioctl_submit_job(), since the domain is assigned last, an
error before that triggers rocket_job_put() -> rocket_job_cleanup()
-> rocket_iommu_domain_put() with the domain still NULL,
causing a panic in that function.

Therefore, the input parameters should be validated.

Fixes: 658ebeac3351 ("accel/rocket: Add IOCTL for BO creation")
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
---
 drivers/accel/rocket/rocket_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/accel/rocket/rocket_drv.c b/drivers/accel/rocket/rocket_drv.c
index 8bbbce594883..77cd2ecce001 100644
--- a/drivers/accel/rocket/rocket_drv.c
+++ b/drivers/accel/rocket/rocket_drv.c
@@ -65,7 +65,8 @@ rocket_iommu_domain_get(struct rocket_file_priv *rocket_priv)
 void
 rocket_iommu_domain_put(struct rocket_iommu_domain *domain)
 {
-	kref_put(&domain->kref, rocket_iommu_domain_destroy);
+	if (domain)
+		kref_put(&domain->kref, rocket_iommu_domain_destroy);
 }
 
 static int
-- 
2.53.0


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

* [PATCH 3/4] accel/rocket: Fix the extra iommu_group_get call in rocket_job_handle_irq
  2026-08-14  2:24 [PATCH 0/4] accel/rocket: resource leak and stability improvements Chaoyi Chen
  2026-08-14  2:24 ` [PATCH 1/4] accel/rocket: Fix the IOMMU domain leak in rocket_ioctl_create_bo Chaoyi Chen
  2026-08-14  2:24 ` [PATCH 2/4] accel/rocket: Fix the panic in rocket_iommu_domain_put when the domain is NULL Chaoyi Chen
@ 2026-08-14  2:24 ` Chaoyi Chen
  2026-08-14  2:24 ` [PATCH 4/4] MAINTAINERS: accel/rocket: Add rockchip mail list for rocket Chaoyi Chen
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyi Chen @ 2026-08-14  2:24 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay, Heiko Stuebner, Jeff Hugo
  Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel,
	Chaoyi Chen

From: Chaoyi Chen <chaoyi.chen@rock-chips.com>

The rocket attaches the IOMMU group in rocket_job_run() and detaches it
in rocket_job_handle_irq(). Calling  iommu_group_get() in
rocket_job_handle_irq() causes the reference count to increase
unexpectedly. And this causes rocket_core_fini() to fail to release the
IOMMU group, leading to a resource leak.

Fixes: 658ebeac3351 ("accel/rocket: Add IOCTL for BO creation")
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
---
 drivers/accel/rocket/rocket_job.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
index 2f1861f960cc..db10848926d8 100644
--- a/drivers/accel/rocket/rocket_job.c
+++ b/drivers/accel/rocket/rocket_job.c
@@ -340,7 +340,7 @@ static void rocket_job_handle_irq(struct rocket_core *core)
 				return;
 			}
 
-			iommu_detach_group(NULL, iommu_group_get(core->dev));
+			iommu_detach_group(NULL, core->iommu_group);
 			dma_fence_signal(core->in_flight_job->done_fence);
 			pm_runtime_put_autosuspend(core->dev);
 			core->in_flight_job = NULL;
-- 
2.53.0


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

* [PATCH 4/4] MAINTAINERS: accel/rocket: Add rockchip mail list for rocket
  2026-08-14  2:24 [PATCH 0/4] accel/rocket: resource leak and stability improvements Chaoyi Chen
                   ` (2 preceding siblings ...)
  2026-08-14  2:24 ` [PATCH 3/4] accel/rocket: Fix the extra iommu_group_get call in rocket_job_handle_irq Chaoyi Chen
@ 2026-08-14  2:24 ` Chaoyi Chen
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyi Chen @ 2026-08-14  2:24 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay, Heiko Stuebner, Jeff Hugo
  Cc: linux-kernel, dri-devel, linux-rockchip, linux-arm-kernel,
	Chaoyi Chen

From: Chaoyi Chen <chaoyi.chen@rock-chips.com>

The rocket is a DRM accel driver for the Rockchip NPU. Add the Rockchip
mailing listso that changes can be tracked.

Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4a8b0fd665ce..388ec1758ce7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7942,6 +7942,7 @@ F:	include/uapi/drm/ivpu_accel.h
 DRM ACCEL DRIVER FOR ROCKCHIP NPU
 M:	Tomeu Vizoso <tomeu@tomeuvizoso.net>
 L:	dri-devel@lists.freedesktop.org
+L:	linux-rockchip@lists.infradead.org
 S:	Supported
 T:	git https://gitlab.freedesktop.org/drm/misc/kernel.git
 F:	Documentation/accel/rocket/
-- 
2.53.0


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

end of thread, other threads:[~2026-08-14  2:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14  2:24 [PATCH 0/4] accel/rocket: resource leak and stability improvements Chaoyi Chen
2026-08-14  2:24 ` [PATCH 1/4] accel/rocket: Fix the IOMMU domain leak in rocket_ioctl_create_bo Chaoyi Chen
2026-08-14  2:24 ` [PATCH 2/4] accel/rocket: Fix the panic in rocket_iommu_domain_put when the domain is NULL Chaoyi Chen
2026-08-14  2:24 ` [PATCH 3/4] accel/rocket: Fix the extra iommu_group_get call in rocket_job_handle_irq Chaoyi Chen
2026-08-14  2:24 ` [PATCH 4/4] MAINTAINERS: accel/rocket: Add rockchip mail list for rocket Chaoyi Chen

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