kernel_samsung_a53x/drivers/gpu/drm/omapdrm
Tomi Valkeinen 11a92febea drm/omap: Fix locking in omap_gem_new_dmabuf()
[ Upstream commit e6a1c4037227539373c8cf484ace83833e2ad6a2 ]

omap_gem_new_dmabuf() creates the new gem object, and then takes and
holds the omap_obj->lock for the rest of the function. This has two
issues:

- omap_gem_free_object(), which is called in the error paths, also takes
  the same lock, leading to deadlock
- Even if the above wouldn't happen, in the error cases
  omap_gem_new_dmabuf() still unlocks omap_obj->lock, even after the
  omap_obj has already been freed.

Furthermore, I don't think there's any reason to take the lock at all,
as the object was just created and not yet shared with anyone else.

To fix all this, drop taking the lock.

Fixes: 3cbd0c587b12 ("drm/omap: gem: Replace struct_mutex usage with omap_obj private lock")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/511b99d7-aade-4f92-bd3e-63163a13d617@stanley.mountain/
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240806-omapdrm-misc-fixes-v1-3-15d31aea0831@ideasonboard.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-17 13:24:03 +01:00
..
displays Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dss Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_connector.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_connector.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_crtc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_crtc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_debugfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_dmm_priv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_dmm_tiler.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_dmm_tiler.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_drv.c Revert "drm: omapdrm: Add missing check for alloc_ordered_workqueue" 2024-11-24 00:23:03 +01:00
omap_drv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_encoder.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_encoder.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_fb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_fb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_fbdev.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_fbdev.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_gem.c drm/omap: Fix locking in omap_gem_new_dmabuf() 2024-12-17 13:24:03 +01:00
omap_gem.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_gem_dmabuf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_irq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_irq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_plane.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
omap_plane.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcm-sita.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
TODO Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00