Skip to content
Snippets Groups Projects
  1. Aug 04, 2023
  2. Jul 28, 2023
  3. Jul 12, 2023
  4. Jul 10, 2023
  5. Jul 06, 2023
  6. Jun 26, 2023
  7. Jun 23, 2023
  8. Jun 19, 2023
  9. Jun 16, 2023
    • Dave Airlie's avatar
      nouveau: fix client work fence deletion race · c8a5d5ea
      Dave Airlie authored
      
      This seems to have existed for ever but is now more apparant after
      commit 9bff18d1 ("drm/ttm: use per BO cleanup workers")
      
      My analysis: two threads are running, one in the irq signalling the
      fence, in dma_fence_signal_timestamp_locked, it has done the
      DMA_FENCE_FLAG_SIGNALLED_BIT setting, but hasn't yet reached the
      callbacks.
      
      The second thread in nouveau_cli_work_ready, where it sees the fence is
      signalled, so then puts the fence, cleanups the object and frees the
      work item, which contains the callback.
      
      Thread one goes again and tries to call the callback and causes the
      use-after-free.
      
      Proposed fix: lock the fence signalled check in nouveau_cli_work_ready,
      so either the callbacks are done or the memory is freed.
      
      Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
      Fixes: 11e451e7 ("drm/nouveau: remove fence wait code from deferred client work handler")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Link: https://lore.kernel.org/dri-devel/20230615024008.1600281-1-airlied@gmail.com/
      c8a5d5ea
  10. Jun 15, 2023
    • Wayne Lin's avatar
      drm/dp_mst: Clear MSG_RDY flag before sending new message · 72f1de49
      Wayne Lin authored
      
      [Why]
      The sequence for collecting down_reply from source perspective should
      be:
      
      Request_n->repeat (get partial reply of Request_n->clear message ready
      flag to ack DPRX that the message is received) till all partial
      replies for Request_n are received->new Request_n+1.
      
      Now there is chance that drm_dp_mst_hpd_irq() will fire new down
      request in the tx queue when the down reply is incomplete. Source is
      restricted to generate interveleaved message transactions so we should
      avoid it.
      
      Also, while assembling partial reply packets, reading out DPCD DOWN_REP
      Sideband MSG buffer + clearing DOWN_REP_MSG_RDY flag should be
      wrapped up as a complete operation for reading out a reply packet.
      Kicking off a new request before clearing DOWN_REP_MSG_RDY flag might
      be risky. e.g. If the reply of the new request has overwritten the
      DPRX DOWN_REP Sideband MSG buffer before source writing one to clear
      DOWN_REP_MSG_RDY flag, source then unintentionally flushes the reply
      for the new request. Should handle the up request in the same way.
      
      [How]
      Separete drm_dp_mst_hpd_irq() into 2 steps. After acking the MST IRQ
      event, driver calls drm_dp_mst_hpd_irq_send_new_request() and might
      trigger drm_dp_mst_kick_tx() only when there is no on going message
      transaction.
      
      Changes since v1:
      * Reworked on review comments received
      -> Adjust the fix to let driver explicitly kick off new down request
      when mst irq event is handled and acked
      -> Adjust the commit message
      
      Changes since v2:
      * Adjust the commit message
      * Adjust the naming of the divided 2 functions and add a new input
        parameter "ack".
      * Adjust code flow as per review comments.
      
      Changes since v3:
      * Update the function description of drm_dp_mst_hpd_irq_handle_event
      
      Changes since v4:
      * Change ack of drm_dp_mst_hpd_irq_handle_event() to be an array align
        the size of esi[]
      
      Signed-off-by: default avatarWayne Lin <Wayne.Lin@amd.com>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      72f1de49
  11. Jun 13, 2023
  12. Jun 07, 2023
    • Christoph Hellwig's avatar
      drm/nouveau: stop using is_swiotlb_active · 0a2f6372
      Christoph Hellwig authored
      
      Drivers have no business looking into dma-mapping internals and check
      what backend is used.  Unfortunstely the DRM core is still broken and
      tries to do plain page allocations instead of using DMA API allocators
      by default and uses various bandaids on when to use dma_alloc_coherent.
      
      Switch nouveau to use the same (broken) scheme as amdgpu and radeon
      to remove the last driver user of is_swiotlb_active.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      0a2f6372
  13. May 22, 2023
  14. Apr 28, 2023
    • Kees Cook's avatar
      drm/nouveau/disp: More DP_RECEIVER_CAP_SIZE array fixes · 25feda6f
      Kees Cook authored
      
      More arrays (and arguments) for dcpd were set to 16, when it looks like
      DP_RECEIVER_CAP_SIZE (15) should be used. Fix the remaining cases, seen
      with GCC 13:
      
      ../drivers/gpu/drm/nouveau/nvif/outp.c: In function 'nvif_outp_acquire_dp':
      ../include/linux/fortify-string.h:57:33: warning: array subscript 'unsigned char[16][0]' is partly outside array bounds of 'u8[15]' {aka 'unsigned char[15]'} [-Warray-bounds=]
         57 | #define __underlying_memcpy     __builtin_memcpy
            |                                 ^
      ...
      ../drivers/gpu/drm/nouveau/nvif/outp.c:140:9: note: in expansion of macro 'memcpy'
        140 |         memcpy(args.dp.dpcd, dpcd, sizeof(args.dp.dpcd));
            |         ^~~~~~
      ../drivers/gpu/drm/nouveau/nvif/outp.c:130:49: note: object 'dpcd' of size [0, 15]
        130 | nvif_outp_acquire_dp(struct nvif_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE],
            |                                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Fixes: 81344372 ("drm/nouveau/disp: move DP link config into acquire")
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: Karol Herbst <kherbst@redhat.com>
      Cc: David Airlie <airlied@gmail.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: nouveau@lists.freedesktop.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
      Signed-off-by: default avatarKarol Herbst <git@karolherbst.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230204184307.never.825-kees@kernel.org
      25feda6f
  15. Apr 17, 2023
Loading