Patch "RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-cm-fix-irq-restore-in-ib_send_cm_sidr_rep.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a4f5e04577a8b5daacd29383dcb1b4eb8ff29e20
Author: Saeed Mahameed <saeedm@xxxxxxxxxx>
Date:   Mon Mar 1 10:18:44 2021 +0200

    RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep
    
    [ Upstream commit 221384df6123747d2a75517dd06cc01752f81518 ]
    
    ib_send_cm_sidr_rep() {
            spin_lock_irqsave()
            cm_send_sidr_rep_locked() {
                    ...
                    spin_lock_irq()
                    ....
                    spin_unlock_irq() <--- this will enable interrupts
            }
            spin_unlock_irqrestore()
    }
    
    spin_unlock_irqrestore() expects interrupts to be disabled but the
    internal spin_unlock_irq() will always enable hard interrupts.
    
    Fix this by replacing the internal spin_{lock,unlock}_irq() with
    irqsave/restore variants.
    
    It fixes the following kernel trace:
    
     raw_local_irq_restore() called with IRQs enabled
     WARNING: CPU: 2 PID: 20001 at kernel/locking/irqflag-debug.c:10 warn_bogus_irq_restore+0x1d/0x20
    
     Call Trace:
      _raw_spin_unlock_irqrestore+0x4e/0x50
      ib_send_cm_sidr_rep+0x3a/0x50 [ib_cm]
      cma_send_sidr_rep+0xa1/0x160 [rdma_cm]
      rdma_accept+0x25e/0x350 [rdma_cm]
      ucma_accept+0x132/0x1cc [rdma_ucm]
      ucma_write+0xbf/0x140 [rdma_ucm]
      vfs_write+0xc1/0x340
      ksys_write+0xb3/0xe0
      do_syscall_64+0x2d/0x40
      entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    Fixes: 87c4c774cbef ("RDMA/cm: Protect access to remote_sidr_table")
    Link: https://lore.kernel.org/r/20210301081844.445823-1-leon@xxxxxxxxxx
    Signed-off-by: Saeed Mahameed <saeedm@xxxxxxxxxx>
    Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 8e578f73a074..bbba0cd42c89 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3650,6 +3650,7 @@ static int cm_send_sidr_rep_locked(struct cm_id_private *cm_id_priv,
 				   struct ib_cm_sidr_rep_param *param)
 {
 	struct ib_mad_send_buf *msg;
+	unsigned long flags;
 	int ret;
 
 	lockdep_assert_held(&cm_id_priv->lock);
@@ -3675,12 +3676,12 @@ static int cm_send_sidr_rep_locked(struct cm_id_private *cm_id_priv,
 		return ret;
 	}
 	cm_id_priv->id.state = IB_CM_IDLE;
-	spin_lock_irq(&cm.lock);
+	spin_lock_irqsave(&cm.lock, flags);
 	if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node)) {
 		rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
 		RB_CLEAR_NODE(&cm_id_priv->sidr_id_node);
 	}
-	spin_unlock_irq(&cm.lock);
+	spin_unlock_irqrestore(&cm.lock, flags);
 	return 0;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux