[PATCH v3] drm/msm: release the fbdev IOVA pin on teardown

From: Michael McAllister

Date: Fri Nov 13 2026 - 15:20:44 EST


The fbdev probe pins its buffer, but normal teardown never drops that
pin. This produces a pin-count warning when the framebuffer is freed.

Keep the setup pin and release it in fb_destroy. Drop the object pin
under its reservation lock, since fbdev destruction can be delayed until
after the KMS VM has been torn down.

Fixes: 7ad0e8cf6317 ("drm/msm: Count how many times iova memory is pinned")
Signed-off-by: Michael McAllister <me@xxxxxxxxxxxxxxxxxxxxx>
---
Hi Dmitry, thanks for the feedback. This keeps the setup pin and drops
it when fbdev is destroyed.

Changes in v3:
- Release the pin during teardown instead of removing it from probe.
- Unpin under the object lock so delayed destruction does not need the
KMS VM.
- Keep this patch focused on the pin leak; leave the mapping and probe
error-path changes for separate follow-ups.

Thanks,
Michael

drivers/gpu/drm/msm/msm_fbdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index dd6d6c507d..29f5dcabc5 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -47,7 +47,11 @@ static void msm_fbdev_fb_destroy(struct fb_info *info)

drm_fb_helper_fini(helper);

- msm_gem_put_vaddr(bo);
+ /* fbdev can outlive the KMS VM; release the object pins directly. */
+ msm_gem_lock(bo);
+ msm_gem_put_vaddr_locked(bo);
+ msm_gem_unpin_locked(bo);
+ msm_gem_unlock(bo);

drm_client_buffer_delete(helper->buffer);
drm_client_release(&helper->client);
--
2.39.5