Skip to content
  • Jerome Glisse's avatar
    drm: mm always protect change to unused_nodes with unused_lock spinlock · a698cf34
    Jerome Glisse authored
    
    
    unused_nodes modification needs to be protected by unused_lock spinlock.
    Here is an example of an usage where there is no such protection without
    this patch.
    
      Process 1: 1-drm_mm_pre_get(this function modify unused_nodes list)
                 2-spin_lock(spinlock protecting mm struct)
                 3-drm_mm_put_block(this function might modify unused_nodes
                   list but doesn't protect modification with unused_lock)
                 4-spin_unlock(spinlock protecting mm struct)
      Process2:  1-drm_mm_pre_get(this function modify unused_nodes list)
    At this point Process1 & Process2 might both be doing modification to
    unused_nodes list. This patch add unused_lock protection into
    drm_mm_put_block to avoid such issue.
    
    Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
    Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
    a698cf34