net: dsa: mv88e6xxx: lock mutex when freeing IRQs
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Tue, 26 Sep 2017 18:57:21 +0000 (14:57 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Sep 2017 17:28:24 +0000 (10:28 -0700)
mv88e6xxx_g2_irq_free locks the registers mutex, but not
mv88e6xxx_g1_irq_free, which results in a stack trace from
assert_reg_lock when unloading the mv88e6xxx module. Fix this.

Fixes: 3460a5770ce9 ("net: dsa: mv88e6xxx: Mask g1 interrupts and free interrupt")
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/chip.c

index 674dab71d71c19b5e56234855544050c8c16a35a..d74c7335c512df11d75dbfc8c89e030c51ad1ee8 100644 (file)
@@ -3951,7 +3951,9 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
        if (chip->irq > 0) {
                if (chip->info->g2_irqs > 0)
                        mv88e6xxx_g2_irq_free(chip);
+               mutex_lock(&chip->reg_lock);
                mv88e6xxx_g1_irq_free(chip);
+               mutex_unlock(&chip->reg_lock);
        }
 }