Skip to content

Commit 5b9f5f1

Browse files
committed
drm/shmem-helper: Fix obj->filp derefence
I broke that in my refactoring: commit 7d2cd72 Author: Daniel Vetter <[email protected]> Date: Fri May 29 16:05:42 2020 +0200 drm/shmem-helpers: Simplify dma-buf importing Tested-by: Thomas Zimmermann <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Reported-by: Thomas Zimmermann <[email protected]> Fixes: 7d2cd72 ("drm/shmem-helpers: Simplify dma-buf importing") Cc: Boris Brezillon <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: Gerd Hoffmann <[email protected]> Cc: Rob Herring <[email protected]> Cc: Noralf Trønnes <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent e7daa38 commit 5b9f5f1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

drivers/gpu/drm/drm_gem_shmem_helper.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private)
7070
mutex_init(&shmem->vmap_lock);
7171
INIT_LIST_HEAD(&shmem->madv_list);
7272

73-
/*
74-
* Our buffers are kept pinned, so allocating them
75-
* from the MOVABLE zone is a really bad idea, and
76-
* conflicts with CMA. See comments above new_inode()
77-
* why this is required _and_ expected if you're
78-
* going to pin these pages.
79-
*/
80-
mapping_set_gfp_mask(obj->filp->f_mapping, GFP_HIGHUSER |
81-
__GFP_RETRY_MAYFAIL | __GFP_NOWARN);
73+
if (!private) {
74+
/*
75+
* Our buffers are kept pinned, so allocating them
76+
* from the MOVABLE zone is a really bad idea, and
77+
* conflicts with CMA. See comments above new_inode()
78+
* why this is required _and_ expected if you're
79+
* going to pin these pages.
80+
*/
81+
mapping_set_gfp_mask(obj->filp->f_mapping, GFP_HIGHUSER |
82+
__GFP_RETRY_MAYFAIL | __GFP_NOWARN);
83+
}
8284

8385
return shmem;
8486

0 commit comments

Comments
 (0)