drm/shmem-helper: Avoid vm_open error paths
authorRob Clark <robdclark@chromium.org>
Wed, 30 Nov 2022 18:57:48 +0000 (10:57 -0800)
committerJavier Martinez Canillas <javierm@redhat.com>
Sun, 4 Dec 2022 17:56:53 +0000 (18:56 +0100)
commit09bf649a74573cb596e211418a4f8008f265c5a9
tree5ba072d14eb9fa8c6e4a55b0d1e0f475454895ed
parent24013314be6ee4ee456114a671e9fa3461323de8
drm/shmem-helper: Avoid vm_open error paths

vm_open() is not allowed to fail.  Fortunately we are guaranteed that
the pages are already pinned, thanks to the initial mmap which is now
being cloned into a forked process, and only need to increment the
refcnt.  So just increment it directly.  Previously if a signal was
delivered at the wrong time to the forking process, the
mutex_lock_interruptible() could fail resulting in the pages_use_count
not being incremented.

Fixes: 2194a63a818d ("drm: Add library for shmem backed GEM objects")
Cc: stable@vger.kernel.org
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221130185748.357410-3-robdclark@gmail.com
drivers/gpu/drm/drm_gem_shmem_helper.c