1. Oct 25, 2023
    • Chengfeng Ye's avatar
      IB/hfi1: Fix potential deadlock on &irq_src_lock and &dd->uctxt_lock · 2f19c4b8
      Chengfeng Ye authored
      
      
      handle_receive_interrupt_napi_sp() running inside interrupt handler
      could introduce inverse lock ordering between &dd->irq_src_lock
      and &dd->uctxt_lock, if read_mod_write() is preempted by the isr.
      
                [CPU0]                                        |          [CPU1]
      hfi1_ipoib_dev_open()                                   |
      --> hfi1_netdev_enable_queues()                         |
      --> enable_queues(rx)                                   |
      --> hfi1_rcvctrl()                                      |
      --> set_intr_bits()                                     |
      --> read_mod_write()                                    |
      --> spin_lock(&dd->irq_src_lock)                        |
                                                              | hfi1_poll()
                                                              | --> poll_next()
                                                              | --> spin_lock_irq(&dd->uctxt_lock)
                                                              |
                                                              | --> hfi1_rcvctrl()
                                                              | --> set_intr_bits()
                                                              | --> read_mod_write()
                                                              | --> spin_lock(&dd->irq_src_lock)
      <interrupt>                                             |
         --> handle_receive_interrupt_napi_sp()               |
         --> set_all_fastpath()                               |
         --> hfi1_rcd_get_by_index()                          |
         --> spin_lock_irqsave(&dd->uctxt_lock)               |
      
      This flaw was found by an experimental static analysis tool I am
      developing for irq-related deadlock.
      
      To prevent the potential deadlock, the patch use spin_lock_irqsave()
      on &dd->irq_src_lock inside read_mod_write() to prevent the possible
      deadlock scenario.
      
      Signed-off-by: default avatarChengfeng Ye <dg573847474@gmail.com>
      Link: https://lore.kernel.org/r/20230926101116.2797-1-dg573847474@gmail.com
      
      
      Acked-by: default avatarDennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      2f19c4b8
  2. Oct 24, 2023
  3. Oct 22, 2023
  4. Oct 19, 2023
  5. Oct 15, 2023
  6. Oct 09, 2023
  7. Oct 05, 2023
  8. Oct 02, 2023
  9. Sep 29, 2023
  10. Sep 28, 2023
  11. Sep 26, 2023