1. 26 Jul, 2021 5 commits
    • Bjorn Andersson's avatar
      dt-bindings: display: simple: Add AUO B133HAN05 & B140HAN06 · fdb57c32
      Bjorn Andersson authored
      Add bindings for the two AUO panels B133HAN05 and B140HAN06, both
      1920x1080 panels with 16.7M colors, first being 13.3" and the latter
      14.0".
      Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210726173300.432039-1-bjorn.andersson@linaro.org
      fdb57c32
    • Zheyu Ma's avatar
      video: fbdev: riva: Error out if 'pixclock' equals zero · f92763cb
      Zheyu Ma authored
      The userspace program could pass any values to the driver through
      ioctl() interface. If the driver doesn't check the value of 'pixclock',
      it may cause divide error.
      
      Fix this by checking whether 'pixclock' is zero first.
      
      The following log reveals it:
      
      [   33.396850] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      [   33.396864] CPU: 5 PID: 11754 Comm: i740 Not tainted 5.14.0-rc2-00513-gac532c9bbcfb-dirty #222
      [   33.396883] RIP: 0010:riva_load_video_mode+0x417/0xf70
      [   33.396969] Call Trace:
      [   33.396973]  ? debug_smp_processor_id+0x1c/0x20
      [   33.396984]  ? tick_nohz_tick_stopped+0x1a/0x90
      [   33.396996]  ? rivafb_copyarea+0x3c0/0x3c0
      [   33.397003]  ? wake_up_klogd.part.0+0x99/0xd0
      [   33.397014]  ? vprintk_emit+0x110/0x4b0
      [   33.397024]  ? vprintk_default+0x26/0x30
      [   33.397033]  ? vprintk+0x9c/0x1f0
      [   33.397041]  ? printk+0xba/0xed
      [   33.397054]  ? record_print_text.cold+0x16/0x16
      [   33.397063]  ? __kasan_check_read+0x11/0x20
      [   33.397074]  ? profile_tick+0xc0/0x100
      [   33.397084]  ? __sanitizer_cov_trace_const_cmp4+0x24/0x80
      [   33.397094]  ? riva_set_rop_solid+0x2a0/0x2a0
      [   33.397102]  rivafb_set_par+0xbe/0x610
      [   33.397111]  ? riva_set_rop_solid+0x2a0/0x2a0
      [   33.397119]  fb_set_var+0x5bf/0xeb0
      [   33.397127]  ? fb_blank+0x1a0/0x1a0
      [   33.397134]  ? lock_acquire+0x1ef/0x530
      [   33.397143]  ? lock_release+0x810/0x810
      [   33.397151]  ? lock_is_held_type+0x100/0x140
      [   33.397159]  ? ___might_sleep+0x1ee/0x2d0
      [   33.397170]  ? __mutex_lock+0x620/0x1190
      [   33.397180]  ? trace_hardirqs_on+0x6a/0x1c0
      [   33.397190]  do_fb_ioctl+0x31e/0x700
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/1627293835-17441-4-git-send-email-zheyuma97@gmail.com
      f92763cb
    • Zheyu Ma's avatar
      video: fbdev: kyro: Error out if 'pixclock' equals zero · 1520b4b7
      Zheyu Ma authored
      The userspace program could pass any values to the driver through
      ioctl() interface. if the driver doesn't check the value of 'pixclock',
      it may cause divide error because the value of 'lineclock' and
      'frameclock' will be zero.
      
      Fix this by checking whether 'pixclock' is zero in kyrofb_check_var().
      
      The following log reveals it:
      
      [  103.073930] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      [  103.073942] CPU: 4 PID: 12483 Comm: syz-executor Not tainted 5.14.0-rc2-00478-g2734d6c1-dirty #118
      [  103.073959] RIP: 0010:kyrofb_set_par+0x316/0xc80
      [  103.074045] Call Trace:
      [  103.074048]  ? ___might_sleep+0x1ee/0x2d0
      [  103.074060]  ? kyrofb_ioctl+0x330/0x330
      [  103.074069]  fb_set_var+0x5bf/0xeb0
      [  103.074078]  ? fb_blank+0x1a0/0x1a0
      [  103.074085]  ? lock_acquire+0x3bd/0x530
      [  103.074094]  ? lock_release+0x810/0x810
      [  103.074103]  ? ___might_sleep+0x1ee/0x2d0
      [  103.074114]  ? __mutex_lock+0x620/0x1190
      [  103.074126]  ? trace_hardirqs_on+0x6a/0x1c0
      [  103.074137]  do_fb_ioctl+0x31e/0x700
      [  103.074144]  ? fb_getput_cmap+0x280/0x280
      [  103.074152]  ? rcu_read_lock_sched_held+0x11/0x80
      [  103.074162]  ? rcu_read_lock_sched_held+0x11/0x80
      [  103.074171]  ? __sanitizer_cov_trace_switch+0x67/0xf0
      [  103.074181]  ? __sanitizer_cov_trace_const_cmp2+0x20/0x80
      [  103.074191]  ? do_vfs_ioctl+0x14b/0x16c0
      [  103.074199]  ? vfs_fileattr_set+0xb60/0xb60
      [  103.074207]  ? rcu_read_lock_sched_held+0x11/0x80
      [  103.074216]  ? lock_release+0x483/0x810
      [  103.074224]  ? __fget_files+0x217/0x3d0
      [  103.074234]  ? __fget_files+0x239/0x3d0
      [  103.074243]  ? do_fb_ioctl+0x700/0x700
      [  103.074250]  fb_ioctl+0xe6/0x130
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/1627293835-17441-3-git-send-email-zheyuma97@gmail.com
      1520b4b7
    • Zheyu Ma's avatar
      video: fbdev: asiliantfb: Error out if 'pixclock' equals zero · b36b242d
      Zheyu Ma authored
      The userspace program could pass any values to the driver through
      ioctl() interface. If the driver doesn't check the value of 'pixclock',
      it may cause divide error.
      
      Fix this by checking whether 'pixclock' is zero first.
      
      The following log reveals it:
      
      [   43.861711] divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      [   43.861737] CPU: 2 PID: 11764 Comm: i740 Not tainted 5.14.0-rc2-00513-gac532c9bbcfb-dirty #224
      [   43.861756] RIP: 0010:asiliantfb_check_var+0x4e/0x730
      [   43.861843] Call Trace:
      [   43.861848]  ? asiliantfb_remove+0x190/0x190
      [   43.861858]  fb_set_var+0x2e4/0xeb0
      [   43.861866]  ? fb_blank+0x1a0/0x1a0
      [   43.861873]  ? lock_acquire+0x1ef/0x530
      [   43.861884]  ? lock_release+0x810/0x810
      [   43.861892]  ? lock_is_held_type+0x100/0x140
      [   43.861903]  ? ___might_sleep+0x1ee/0x2d0
      [   43.861914]  ? __mutex_lock+0x620/0x1190
      [   43.861921]  ? do_fb_ioctl+0x313/0x700
      [   43.861929]  ? mutex_lock_io_nested+0xfa0/0xfa0
      [   43.861936]  ? __this_cpu_preempt_check+0x1d/0x30
      [   43.861944]  ? _raw_spin_unlock_irqrestore+0x46/0x60
      [   43.861952]  ? lockdep_hardirqs_on+0x59/0x100
      [   43.861959]  ? _raw_spin_unlock_irqrestore+0x46/0x60
      [   43.861967]  ? trace_hardirqs_on+0x6a/0x1c0
      [   43.861978]  do_fb_ioctl+0x31e/0x700
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/1627293835-17441-2-git-send-email-zheyuma97@gmail.com
      b36b242d
    • Simon Ser's avatar
      drm: document drm_property_enum.value for bitfields · 3012248f
      Simon Ser authored
      When a property has the type DRM_MODE_PROP_BITMASK, the value field
      stores a bitshift, not a bitmask, which can be surprising.
      Signed-off-by: default avatarSimon Ser <contact@emersion.fr>
      Cc: Leandro Ribeiro <leandro.ribeiro@collabora.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Acked-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/NUZTPTKKZtAlDhxIXFB1qrUqWBYKapkBxCnb1S1bc3g@cp3-web-033.plabs.ch
      3012248f
  2. 25 Jul, 2021 9 commits
  3. 23 Jul, 2021 11 commits
  4. 22 Jul, 2021 1 commit
  5. 21 Jul, 2021 11 commits
  6. 20 Jul, 2021 3 commits
    • Juan A. Suarez Romero's avatar
      drm/v3d: Expose performance counters to userspace · 26a4dc29
      Juan A. Suarez Romero authored
      The V3D engine has several hardware performance counters that can of
      interest for userspace performance analysis tools.
      
      This exposes new ioctls to create and destroy performance monitor
      objects, as well as to query the counter values.
      
      Each created performance monitor object has an ID that can be attached
      to CL/CSD submissions, so the driver enables the requested counters when
      the job is submitted, and updates the performance monitor values when
      the job is done.
      
      It is up to the user to ensure all the jobs have been finished before
      getting the performance monitor values. It is also up to the user to
      properly synchronize BCL jobs when submitting jobs with different
      performance monitors attached.
      
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Emma Anholt <emma@anholt.net>
      To: dri-devel@lists.freedesktop.org
      Signed-off-by: default avatarJuan A. Suarez Romero <jasuarez@igalia.com>
      Acked-by: default avatarMelissa Wen <mwen@igalia.com>
      Signed-off-by: default avatarMelissa Wen <melissa.srw@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210608111541.461991-1-jasuarez@igalia.com
      26a4dc29
    • Desmond Cheong Zhi Xi's avatar
      drm: protect drm_master pointers in drm_lease.c · 56f0729a
      Desmond Cheong Zhi Xi authored
      drm_file->master pointers should be protected by
      drm_device.master_mutex or drm_file.master_lookup_lock when being
      dereferenced.
      
      However, in drm_lease.c, there are multiple instances where
      drm_file->master is accessed and dereferenced while neither lock is
      held. This makes drm_lease.c vulnerable to use-after-free bugs.
      
      We address this issue in 2 ways:
      
      1. Add a new drm_file_get_master() function that calls drm_master_get
      on drm_file->master while holding on to
      drm_file.master_lookup_lock. Since drm_master_get increments the
      reference count of master, this prevents master from being freed until
      we unreference it with drm_master_put.
      
      2. In each case where drm_file->master is directly accessed and
      eventually dereferenced in drm_lease.c, we wrap the access in a call
      to the new drm_file_get_master function, then unreference the master
      pointer once we are done using it.
      Reported-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDesmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
      Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210712043508.11584-6-desmondcheongzx@gmail.com
      56f0729a
    • Desmond Cheong Zhi Xi's avatar
      drm: serialize drm_file.master with a new spinlock · 0b0860a3
      Desmond Cheong Zhi Xi authored
      Currently, drm_file.master pointers should be protected by
      drm_device.master_mutex when being dereferenced. This is because
      drm_file.master is not invariant for the lifetime of drm_file. If
      drm_file is not the creator of master, then drm_file.is_master is
      false, and a call to drm_setmaster_ioctl will invoke
      drm_new_set_master, which then allocates a new master for drm_file and
      puts the old master.
      
      Thus, without holding drm_device.master_mutex, the old value of
      drm_file.master could be freed while it is being used by another
      concurrent process.
      
      However, it is not always possible to lock drm_device.master_mutex to
      dereference drm_file.master. Through the fbdev emulation code, this
      might occur in a deep nest of other locks. But drm_device.master_mutex
      is also the outermost lock in the nesting hierarchy, so this leads to
      potential deadlocks.
      
      To address this, we introduce a new spin lock at the bottom of the
      lock hierarchy that only serializes drm_file.master. With this change,
      the value of drm_file.master changes only when both
      drm_device.master_mutex and drm_file.master_lookup_lock are
      held. Hence, any process holding either of those locks can ensure that
      the value of drm_file.master will not change concurrently.
      
      Since no lock depends on the new drm_file.master_lookup_lock, when
      drm_file.master is dereferenced, but drm_device.master_mutex cannot be
      held, we can safely protect the master pointer with
      drm_file.master_lookup_lock.
      Reported-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDesmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210712043508.11584-5-desmondcheongzx@gmail.com
      0b0860a3