[PATCH v2 0/6] drm/rockchip: Fix error handling and resource leaks in Rockchip DRM drivers
Jiaqi
shijiaqi_develop at 163.com
Fri May 8 21:16:58 PDT 2026
This is v2 of the patch series that was previously withdrawn due to
a critical bug in Patch 3/6.
Changes in v2:
- Patch 3/6: Removed incorrect devm_free_irq() call in error path.
The IRQ registered via devm_request_irq() is managed by devres and
must NOT be manually freed. The corrected patch simply jumps to
err_crtcs label for proper cleanup via vop2_destroy_crtcs().
- Patch 5/6: Fixed trailing format issue that caused checkpatch ERROR.
This patch series fixes 6 bugs in the Rockchip DRM driver subsystem,
identified through static code analysis and confirmed by technical review.
The bugs range from Critical (of_node reference leaks, use-after-free)
to Medium (unchecked return values), and span 5 different source files.
Each patch addresses exactly one bug to facilitate review and bisection.
Summary of fixes:
Patch 1/6 (Critical): Fix of_node reference leak in
rockchip_drm_encoder_set_crtc_endpoint_id(). Both success and error
paths leaked references acquired via of_graph helpers.
Patch 2/6 (Critical): Fix dangling crtc->state in vop2_crtc_reset().
kzalloc() failure left crtc->state as a use-after-free pointer.
Patch 3/6 (High): Fix vop2_create_crtcs() error path cleanup in
vop2_bind(). Failures returned directly without calling
vop2_destroy_crtcs(), leaking of_node references. (v2: fixed
double-free by removing manual devm_free_irq())
Patch 4/6 (High): Fix vmap address caching in
rockchip_gem_prime_vmap(). New vmap() results were not saved to
rk_obj->kvaddr, causing repeated mappings and potential leaks.
Patch 5/6 (High): Fix leaked vblank event in
vop_crtc_atomic_disable(). Pending vop->event was warned but never
sent, causing userspace hangs and vblank reference leaks. (v2:
fixed checkpatch format error)
Patch 6/6 (Medium): Check return value of cdn_dp_grf_write() in
cdn_dp_enable_phy() error path. Ignored return value could leave
GRF registers in an inconsistent state.
All patches have been verified against checkpatch.pl --strict.
Signed-off-by: Jiaqi <shijiaqi_develop at 163.com>
---
drivers/gpu/drm/rockchip/cdn-dp-core.c | 5 +++--
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 14 +++++++++----
drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 1 +
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 11 ++++++++++-
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2 +-
5 files changed, 35 insertions(+), 9 deletions(-)
More information about the Linux-rockchip
mailing list