linux-yocto/drivers/gpu/host1x
Mainak Sen 79197c6007 gpu: host1x: Fix race in syncpt alloc/free
[ Upstream commit c7d393267c497502fa737607f435f05dfe6e3d9b ]

Fix race condition between host1x_syncpt_alloc()
and host1x_syncpt_put() by using kref_put_mutex()
instead of kref_put() + manual mutex locking.

This ensures no thread can acquire the
syncpt_mutex after the refcount drops to zero
but before syncpt_release acquires it.
This prevents races where syncpoints could
be allocated while still being cleaned up
from a previous release.

Remove explicit mutex locking in syncpt_release
as kref_put_mutex() handles this atomically.

Signed-off-by: Mainak Sen <msen@nvidia.com>
Fixes: f5ba33fb96 ("gpu: host1x: Reserve VBLANK syncpoints at initialization")
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20250707-host1x-syncpt-race-fix-v1-1-28b0776e70bc@nvidia.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-12-18 14:02:25 +01:00
..
hw gpu: host1x: Add MLOCK recovery for rest of engines 2024-08-29 20:14:29 +02:00
bus.c gpu: host1x: Use for_each_available_child_of_node_scoped() 2025-05-07 18:09:30 +02:00
bus.h gpu: host1x: bus: make host1x_bus_type const 2024-02-13 19:10:57 +01:00
cdma.c gpu: host1x: Remove mid-job CDMA flushes 2025-05-07 17:49:59 +02:00
cdma.h gpu: host1x: Implement job tracking using DMA fences 2023-01-26 15:55:38 +01:00
channel.c gpu: host1x: Stop CDMA before suspending 2023-10-11 22:52:44 +02:00
channel.h gpu: host1x: Stop CDMA before suspending 2023-10-11 22:52:44 +02:00
context_bus.c gpu: host1x: Make host1x_context_device_bus_type constant 2024-08-29 20:14:29 +02:00
context.c gpu: host1x: Set up device DMA parameters 2024-09-25 21:21:23 +02:00
context.h gpu: host1x: Add context device management code 2022-07-08 16:27:52 +02:00
debug.c gpu: host1x: Remove unused host1x_debug_dump_syncpts 2025-02-28 17:44:13 +01:00
debug.h gpu: host1x: Remove unused host1x_debug_dump_syncpts 2025-02-28 17:44:13 +01:00
dev.c gpu: host1x: Do not assume that a NULL domain means no DMA IOMMU 2025-03-19 19:05:40 +01:00
dev.h gpu: host1x: Fix _writel function declarations 2024-08-29 20:14:29 +02:00
fence.c gpu: host1x: External timeout/cancellation for fences 2023-01-26 15:55:38 +01:00
fence.h gpu: host1x: External timeout/cancellation for fences 2023-01-26 15:55:38 +01:00
intr.c gpu: host1x: Fix a use of uninitialized mutex 2025-02-07 15:57:50 +01:00
intr.h gpu: host1x: Request syncpoint IRQs only during probe 2024-08-28 17:28:48 +02:00
job.c gpu: host1x: Implement job tracking using DMA fences 2023-01-26 15:55:38 +01:00
job.h drm/tegra: Implement correct DMA-BUF semantics 2021-12-16 14:07:06 +01:00
Kconfig drm/tegra: Allow compile test on !ARM v2 2023-04-04 18:04:43 +02:00
Makefile gpu: host1x: Tegra234 device data and headers 2022-07-08 16:27:52 +02:00
mipi.c gpu: host1x: mipi: Benefit from devm_clk_get_prepared() 2024-05-27 10:13:55 +02:00
syncpt.c gpu: host1x: Fix race in syncpt alloc/free 2025-12-18 14:02:25 +01:00
syncpt.h gpu: host1x: Rewrite syncpoint interrupt handling 2023-01-26 15:55:38 +01:00