When DEV_INFO fails for the embedded link in mt7925_change_vif_links(), mt7925_mac_link_bss_add() keeps the BSS of that link but frees its BMC wcid. The next association of a P2P client must allocate a new BMC wcid, and where none is free the add fails before it sets up the BSS, while mconf->mt76.idx and the deflink wcid index name a BSS that the interface no longer holds. mt7925_remove_interface() then removes that BSS index and wcid slot, which another interface can hold by then. Keep the BMC wcid of the embedded link as long as its BSS, and free it together with the BSS where a failed add is undone. Fixes: 4dd53cf06f01 ("wifi: mt76: mt7925: give every P2P interface a BMC wcid of its own") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 0908c22c3dff..b6eca78a5e51 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -384,6 +384,7 @@ static void mt7925_mac_link_bss_unwind(struct mt792x_dev *dev, mt76_wcid_cleanup(&dev->mt76, &mlink->wcid); dev->mt76.vif_mask &= ~BIT_ULL(mconf->mt76.idx); mconf->vif->phy->omac_mask &= ~BIT_ULL(mconf->mt76.omac_idx); + mt7925_p2p_bmc_remove(dev, mconf); } static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, @@ -461,7 +462,6 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, if (ret) { if (mconf != &mvif->bss_conf) mt7925_mac_link_bss_unwind(dev, mconf, mlink); - mt7925_p2p_bmc_remove(dev, mconf); goto out; } -- 2.47.3