Skip to content

Commit

Permalink
mt76: mt7915: fix possible NULL pointer dereference in mt7915_registe…
Browse files Browse the repository at this point in the history
…r_ext_phy

Fix a NULL pointer dereference in mt7915_register_ext_phy since phy
data structure is allocated by mt76_alloc_phy routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
Lorenzo Bianconi authored and Felix Fietkau committed May 28, 2020
1 parent eca0265 commit ec2bb3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/mediatek/mt76/mt7915/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ int mt7915_register_ext_phy(struct mt7915_dev *dev)
if (phy)
return 0;

INIT_DELAYED_WORK(&phy->mac_work, mt7915_mac_work);
mt7915_cap_dbdc_enable(dev);
mphy = mt76_alloc_phy(&dev->mt76, sizeof(*phy), &mt7915_ops);
if (!mphy)
Expand All @@ -605,6 +604,8 @@ int mt7915_register_ext_phy(struct mt7915_dev *dev)
mphy->antenna_mask = BIT(hweight8(phy->chainmask)) - 1;
mt7915_init_wiphy(mphy->hw);

INIT_DELAYED_WORK(&phy->mac_work, mt7915_mac_work);

/*
* Make the secondary PHY MAC address local without overlapping with
* the usual MAC address allocation scheme on multiple virtual interfaces
Expand Down

0 comments on commit ec2bb3a

Please sign in to comment.