This will make it possible to iterate over
interface list while in an atomic context,
i.e. tasklet.

Caller should still be careful with accessing
arvif structures though.

Signed-off-by: Michal Kazior <[email protected]>
---
 drivers/net/wireless/ath/ath10k/mac.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 16fddc7..721b2ce 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3325,7 +3325,10 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
        }
 
        ar->free_vdev_map &= ~(1LL << arvif->vdev_id);
+
+       spin_lock_bh(&ar->data_lock);
        list_add(&arvif->list, &ar->arvifs);
+       spin_unlock_bh(&ar->data_lock);
 
        /* It makes no sense to have firmware do keepalives. mac80211 already
         * takes care of this with idle connection polling.
@@ -3452,7 +3455,9 @@ err_peer_delete:
 err_vdev_delete:
        ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
        ar->free_vdev_map |= 1LL << arvif->vdev_id;
+       spin_lock_bh(&ar->data_lock);
        list_del(&arvif->list);
+       spin_unlock_bh(&ar->data_lock);
 
 err:
        if (arvif->beacon_buf) {
@@ -3487,7 +3492,10 @@ static void ath10k_remove_interface(struct ieee80211_hw 
*hw,
                            arvif->vdev_id, ret);
 
        ar->free_vdev_map |= 1LL << arvif->vdev_id;
+
+       spin_lock_bh(&ar->data_lock);
        list_del(&arvif->list);
+       spin_unlock_bh(&ar->data_lock);
 
        if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
                ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, vif->addr);
-- 
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to