]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
IB/mlx4: Fix potential deadlock when sending mad to wire
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Thu, 30 Jul 2015 14:34:21 +0000 (17:34 +0300)
committerDoug Ledford <dledford@redhat.com>
Sun, 30 Aug 2015 22:12:22 +0000 (18:12 -0400)
send_mad_to_wire takes the same spinlock that is taken in
the interrupt context.  Therefore, it needs irqsave/restore.

Fixes: b9c5d6a64358 ('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>
drivers/infiniband/hw/mlx4/mcg.c

index ed327e6c8fdca54baf19c3ded92d60776cc1adbf..a0559a8af4f4dcba80f0d6db630a8ca633d18e7c 100644 (file)
@@ -206,15 +206,16 @@ static int send_mad_to_wire(struct mlx4_ib_demux_ctx *ctx, struct ib_mad *mad)
 {
        struct mlx4_ib_dev *dev = ctx->dev;
        struct ib_ah_attr       ah_attr;
+       unsigned long flags;
 
-       spin_lock(&dev->sm_lock);
+       spin_lock_irqsave(&dev->sm_lock, flags);
        if (!dev->sm_ah[ctx->port - 1]) {
                /* port is not yet Active, sm_ah not ready */
-               spin_unlock(&dev->sm_lock);
+               spin_unlock_irqrestore(&dev->sm_lock, flags);
                return -EAGAIN;
        }
        mlx4_ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr);
-       spin_unlock(&dev->sm_lock);
+       spin_unlock_irqrestore(&dev->sm_lock, flags);
        return mlx4_ib_send_to_wire(dev, mlx4_master_func_num(dev->dev),
                                    ctx->port, IB_QPT_GSI, 0, 1, IB_QP1_QKEY,
                                    &ah_attr, NULL, mad);