mt76: mt7615: fix possible deadlock while mt7615_register_ext_phy()
authorPeter Chiu <chui-hao.chiu@mediatek.com>
Mon, 1 Nov 2021 02:01:13 +0000 (10:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:04:45 +0000 (11:04 +0100)
[ Upstream commit 8c55516de3f9b76b9d9444e7890682ec2efc809f ]

ieee80211_register_hw() is called with rtnl_lock held, and this could be
caused lockdep from a work item that's on a workqueue that is flushed
with the rtnl held.

Move mt7615_register_ext_phy() outside the init_work().

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c

index a2465b4..87b4aa5 100644 (file)
@@ -28,8 +28,6 @@ static void mt7615_pci_init_work(struct work_struct *work)
                return;
 
        mt7615_init_work(dev);
-       if (dev->dbdc_support)
-               mt7615_register_ext_phy(dev);
 }
 
 static int mt7615_init_hardware(struct mt7615_dev *dev)
@@ -160,6 +158,12 @@ int mt7615_register_device(struct mt7615_dev *dev)
        mt7615_init_txpower(dev, &dev->mphy.sband_2g.sband);
        mt7615_init_txpower(dev, &dev->mphy.sband_5g.sband);
 
+       if (dev->dbdc_support) {
+               ret = mt7615_register_ext_phy(dev);
+               if (ret)
+                       return ret;
+       }
+
        return mt7615_init_debugfs(dev);
 }