]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/shmem-helper: Remove errant put in error path
authorRob Clark <robdclark@chromium.org>
Wed, 30 Nov 2022 18:57:47 +0000 (10:57 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Dec 2022 10:30:43 +0000 (11:30 +0100)
commit 24013314be6ee4ee456114a671e9fa3461323de8 upstream.

drm_gem_shmem_mmap() doesn't own this reference, resulting in the GEM
object getting prematurely freed leading to a later use-after-free.

Link: https://syzkaller.appspot.com/bug?extid=c8ae65286134dd1b800d
Reported-by: syzbot+c8ae65286134dd1b800d@syzkaller.appspotmail.com
Fixes: 1f4e743ab37e ("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-2-robdclark@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/drm_gem_shmem_helper.c

index d88f4230c22195a626070cca0e657a4a538cf3da..d266fbb37319a31af9f7ec6b21ad3a03811b3409 100644 (file)
@@ -554,10 +554,8 @@ int drm_gem_shmem_mmap(struct file *filp, struct vm_area_struct *vma)
        shmem = to_drm_gem_shmem_obj(vma->vm_private_data);
 
        ret = drm_gem_shmem_get_pages(shmem);
-       if (ret) {
-               drm_gem_vm_close(vma);
+       if (ret)
                return ret;
-       }
 
        /* VM_PFNMAP was set by drm_gem_mmap() */
        vma->vm_flags &= ~VM_PFNMAP;