Skip to content

Commit fe5e52b

Browse files
Jack Morgensteingregkh
authored andcommitted
IB/mlx4: Fix potential deadlock when sending mad to wire
commit 90c1d8b6350cca9d8a234f03c77a317a7613bcee upstream. send_mad_to_wire takes the same spinlock that is taken in the interrupt context. Therefore, it needs irqsave/restore. Fixes: b9c5d6a ('IB/mlx4: Add multicast group (MCG) paravirtualization for SR-IOV') Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2678306 commit fe5e52b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • drivers/infiniband/hw/mlx4

‎drivers/infiniband/hw/mlx4/mcg.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,16 @@ static int send_mad_to_wire(struct mlx4_ib_demux_ctx *ctx, struct ib_mad *mad)
206206
{
207207
struct mlx4_ib_dev *dev = ctx->dev;
208208
struct ib_ah_attr ah_attr;
209+
unsigned long flags;
209210

210-
spin_lock(&dev->sm_lock);
211+
spin_lock_irqsave(&dev->sm_lock, flags);
211212
if (!dev->sm_ah[ctx->port - 1]) {
212213
/* port is not yet Active, sm_ah not ready */
213-
spin_unlock(&dev->sm_lock);
214+
spin_unlock_irqrestore(&dev->sm_lock, flags);
214215
return -EAGAIN;
215216
}
216217
mlx4_ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr);
217-
spin_unlock(&dev->sm_lock);
218+
spin_unlock_irqrestore(&dev->sm_lock, flags);
218219
return mlx4_ib_send_to_wire(dev, mlx4_master_func_num(dev->dev),
219220
ctx->port, IB_QPT_GSI, 0, 1, IB_QP1_QKEY,
220221
&ah_attr, NULL, mad);

0 commit comments

Comments
 (0)