drm: Copy drm_wait_vblank to user before returning
authorjsg <jsg@openbsd.org>
Thu, 9 Sep 2021 04:09:41 +0000 (04:09 +0000)
committerjsg <jsg@openbsd.org>
Thu, 9 Sep 2021 04:09:41 +0000 (04:09 +0000)
From Mark Yacoub
6fd6e20520ccd05a1ac3321404dd498cc28576cb in linux 5.10.y/5.10.62
fa0b1ef5f7a694f48e00804a391245f3471aa155 in mainline linux

sys/dev/pci/drm/drm_ioc32.c

index dc734d4..aaf8d62 100644 (file)
@@ -865,8 +865,6 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
        req.request.sequence = req32.request.sequence;
        req.request.signal = req32.request.signal;
        err = drm_ioctl_kernel(file, drm_wait_vblank_ioctl, &req, DRM_UNLOCKED);
-       if (err)
-               return err;
 
        req32.reply.type = req.reply.type;
        req32.reply.sequence = req.reply.sequence;
@@ -875,7 +873,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
        if (copy_to_user(argp, &req32, sizeof(req32)))
                return -EFAULT;
 
-       return 0;
+       return err;
 }
 
 #if defined(CONFIG_X86)