1. 04 Sep, 2022 8 commits
  2. 02 Sep, 2022 6 commits
  3. 01 Sep, 2022 4 commits
  4. 30 Aug, 2022 4 commits
  5. 29 Aug, 2022 7 commits
  6. 26 Aug, 2022 6 commits
  7. 25 Aug, 2022 5 commits
    • Rob Clark's avatar
      drm/virtio: Fix same-context optimization · 3007dc2a
      Rob Clark authored
      When VIRTGPU_EXECBUF_RING_IDX is used, we should be considering the
      timeline that the EB if running on rather than the global driver fence
      context.
      
      Fixes: 85c83ea9 ("drm/virtio: implement context init: allocate an array of fence contexts")
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Link: http://patchwork.freedesktop.org/patch/msgid/20220812224001.2806463-1-robdclark@gmail.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      3007dc2a
    • Vivek Kasireddy's avatar
      udmabuf: Set ubuf->sg = NULL if the creation of sg table fails · d9c04a1b
      Vivek Kasireddy authored
      When userspace tries to map the dmabuf and if for some reason
      (e.g. OOM) the creation of the sg table fails, ubuf->sg needs to be
      set to NULL. Otherwise, when the userspace subsequently closes the
      dmabuf fd, we'd try to erroneously free the invalid sg table from
      release_udmabuf resulting in the following crash reported by syzbot:
      
      general protection fault, probably for non-canonical address
      0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
      KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
      CPU: 0 PID: 3609 Comm: syz-executor487 Not tainted
      5.19.0-syzkaller-13930-g7ebfc85e #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 07/22/2022
      RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline]
      RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline]
      RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114
      Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c
      8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14
      02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2
      RSP: 0018:ffffc900037efd30 EFLAGS: 00010246
      RAX: dffffc0000000000 RBX: ffffffff8cb67800 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffffffff84ad27e0 RDI: 0000000000000000
      RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000
      R10: 0000000000000000 R11: 000000000008c07c R12: ffff88801fa05000
      R13: ffff888073db07e8 R14: ffff888025c25440 R15: 0000000000000000
      FS:  0000555555fc4300(0000) GS:ffff8880b9a00000(0000)
      knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fc1c0ce06e4 CR3: 00000000715e6000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       dma_buf_release+0x157/0x2d0 drivers/dma-buf/dma-buf.c:78
       __dentry_kill+0x42b/0x640 fs/dcache.c:612
       dentry_kill fs/dcache.c:733 [inline]
       dput+0x806/0xdb0 fs/dcache.c:913
       __fput+0x39c/0x9d0 fs/file_table.c:333
       task_work_run+0xdd/0x1a0 kernel/task_work.c:177
       ptrace_notify+0x114/0x140 kernel/signal.c:2353
       ptrace_report_syscall include/linux/ptrace.h:420 [inline]
       ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline]
       syscall_exit_work kernel/entry/common.c:249 [inline]
       syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:276
       __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline]
       syscall_exit_to_user_mode+0x9/0x50 kernel/entry/common.c:294
       do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7fc1c0c35b6b
      Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24
      0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00
      f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
      RSP: 002b:00007ffd78a06090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
      RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007fc1c0c35b6b
      RDX: 0000000020000280 RSI: 0000000040086200 RDI: 0000000000000006
      RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000293 R12: 000000000000000c
      R13: 0000000000000003 R14: 00007fc1c0cfe4a0 R15: 00007ffd78a06140
       </TASK>
      Modules linked in:
      ---[ end trace 0000000000000000 ]---
      RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline]
      RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline]
      RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114
      
      Reported-by: syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: default avatarVivek Kasireddy <vivek.kasireddy@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20220825063522.801264-1-vivek.kasireddy@intel.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      d9c04a1b
    • Danilo Krummrich's avatar
      drm/vc4: hvs: protect drm_print_regset32() · b3be4520
      Danilo Krummrich authored
      In vc4_hvs_dump_state() potentially freed resources are protected from
      being accessed with drm_dev_enter()/drm_dev_exit().
      
      Also include drm_print_regset32() in the protected section, since
      drm_print_regset32() does access memory that is typically mapped via
      devm_* calls.
      
      Fixes: 969cfae1 ("drm/vc4: hvs: Protect device resources after removal")
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20220824161327.330627-5-dakr@redhat.com
      b3be4520
    • Danilo Krummrich's avatar
      drm/vc4: crtc: protect device resources after removal · e0c95303
      Danilo Krummrich authored
      (Hardware) resources which are bound to the driver and device lifecycle
      must not be accessed after the device and driver are unbound.
      
      However, the DRM device isn't freed as long as the last user closed it,
      hence userspace can still call into the driver.
      
      Therefore protect the critical sections which are accessing those
      resources with drm_dev_enter() and drm_dev_exit().
      
      Fixes: 7cc4214c ("drm/vc4: crtc: Switch to drmm_kzalloc")
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20220824161327.330627-4-dakr@redhat.com
      e0c95303
    • Danilo Krummrich's avatar
      drm/vc4: plane: protect device resources after removal · 6acb416b
      Danilo Krummrich authored
      (Hardware) resources which are bound to the driver and device lifecycle
      must not be accessed after the device and driver are unbound.
      
      However, the DRM device isn't freed as long as the last user closed it,
      hence userspace can still call into the driver.
      
      Therefore protect the critical sections which are accessing those
      resources with drm_dev_enter() and drm_dev_exit().
      
      Fixes: 9872c7a3 ("drm/vc4: plane: Switch to drmm_universal_plane_alloc()")
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20220824161327.330627-3-dakr@redhat.com
      6acb416b