Skip to content

Commit 221384d

Browse files
Saeed Mahameedjgunthorpe
authored andcommitted
RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep
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: 87c4c77 ("RDMA/cm: Protect access to remote_sidr_table") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Saeed Mahameed <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent fe07bfd commit 221384d

File tree

1 file changed

+3
-2
lines changed
  • drivers/infiniband/core

1 file changed

+3
-2
lines changed

drivers/infiniband/core/cm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,6 +3651,7 @@ static int cm_send_sidr_rep_locked(struct cm_id_private *cm_id_priv,
36513651
struct ib_cm_sidr_rep_param *param)
36523652
{
36533653
struct ib_mad_send_buf *msg;
3654+
unsigned long flags;
36543655
int ret;
36553656

36563657
lockdep_assert_held(&cm_id_priv->lock);
@@ -3676,12 +3677,12 @@ static int cm_send_sidr_rep_locked(struct cm_id_private *cm_id_priv,
36763677
return ret;
36773678
}
36783679
cm_id_priv->id.state = IB_CM_IDLE;
3679-
spin_lock_irq(&cm.lock);
3680+
spin_lock_irqsave(&cm.lock, flags);
36803681
if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node)) {
36813682
rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
36823683
RB_CLEAR_NODE(&cm_id_priv->sidr_id_node);
36833684
}
3684-
spin_unlock_irq(&cm.lock);
3685+
spin_unlock_irqrestore(&cm.lock, flags);
36853686
return 0;
36863687
}
36873688

0 commit comments

Comments
 (0)