mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7915: fix ext PHY use-after-free on register error path
After mt7915_register_ext_phy() succeeded, a failure of the main PHY
mt7915_init_debugfs() or mt7915_coredump_register() unwound through
free_phy2, which called ieee80211_free_hw() on the ext PHY hw while it
was still registered with mac80211, since mt76_unregister_device() only
unregisters the main hw. Unregister the ext PHY (thermal + phy + hw)
first and skip the redundant free.
Fixes: 7b8e1ae886e4 ("mt76: mt7915: rework hardware/phy initialization")
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+7
-2
@@ -1335,14 +1335,19 @@ int mt7915_register_device(struct mt7915_dev *dev)
|
|||||||
|
|
||||||
ret = mt7915_init_debugfs(&dev->phy);
|
ret = mt7915_init_debugfs(&dev->phy);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto unreg_thermal;
|
goto unreg_ext_phy;
|
||||||
|
|
||||||
ret = mt7915_coredump_register(dev);
|
ret = mt7915_coredump_register(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto unreg_thermal;
|
goto unreg_ext_phy;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
unreg_ext_phy:
|
||||||
|
if (phy2) {
|
||||||
|
mt7915_unregister_ext_phy(dev);
|
||||||
|
phy2 = NULL;
|
||||||
|
}
|
||||||
unreg_thermal:
|
unreg_thermal:
|
||||||
mt7915_unregister_thermal(&dev->phy);
|
mt7915_unregister_thermal(&dev->phy);
|
||||||
unreg_dev:
|
unreg_dev:
|
||||||
|
|||||||
Reference in New Issue
Block a user