[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220529162936.2539901-1-robdclark@gmail.com>
Date: Sun, 29 May 2022 09:29:36 -0700
From: Rob Clark <robdclark@...il.com>
To: dri-devel@...ts.freedesktop.org
Cc: freedreno@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org,
Rob Clark <robdclark@...omium.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Gerd Hoffmann <kraxel@...hat.com>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] drm/prime: Ensure mmap offset is initialized
From: Rob Clark <robdclark@...omium.org>
If a GEM object is allocated, and then exported as a dma-buf fd which is
mmap'd before or without the GEM buffer being directly mmap'd, the
vma_node could be unitialized. This leads to a situation where the CPU
mapping is not correctly torn down in drm_vma_node_unmap().
Fixes: e5516553999f ("drm: call drm_gem_object_funcs.mmap with fake offset")
Signed-off-by: Rob Clark <robdclark@...omium.org>
---
Note, it's possible the issue existed in some related form prior to the
commit tagged with Fixes.
drivers/gpu/drm/drm_prime.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index e3f09f18110c..849eea154dfc 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -716,6 +716,11 @@ int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
struct file *fil;
int ret;
+ /* Ensure that the vma_node is initialized: */
+ ret = drm_gem_create_mmap_offset(obj);
+ if (ret)
+ return ret;
+
/* Add the fake offset */
vma->vm_pgoff += drm_vma_node_start(&obj->vma_node);
--
2.35.3
Powered by blists - more mailing lists