Skip to contentSkip to conversation

ath10k: remove stale peers upon vif removal

PATCH New Michal Kazior 2 participants 2 messages May 8, 2013 – May 9, 2013 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath10k: remove stale peers upon vif removal

Fixes leak of ath10k_peer structures if FW stops responding suddenly and we unload the driver (e.g. eject the device while we're associated and unload the driver).

---
 drivers/net/wireless/ath/ath10k/mac.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +22 -0
index 930a092..818b8e6 100644
@@ -350,6 +350,26 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr)
 	return 0;
 }
 
+static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)
+{
+	struct ath10k_peer *peer, *tmp;
+
+	lockdep_assert_held(&ar->conf_mutex);
+
+	spin_lock_bh(&ar->data_lock);
+	list_for_each_entry_safe(peer, tmp, &ar->peers, list) {
+		if (peer->vdev_id != vdev_id)
+			continue;
+
+		ath10k_warn("removing stale peer %pM from vdev_id %d\n",
+			    peer->addr, vdev_id);
+
+		list_del(&peer->list);
+		kfree(peer);
+	}
+	spin_unlock_bh(&ar->data_lock);
+}
+
 /************************/
 /* Interface management */
 /************************/
@@ -1773,6 +1793,8 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
 	if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
 		ar->monitor_present = false;
 
+	ath10k_peer_cleanup(ar, arvif->vdev_id);
+
 	mutex_unlock(&ar->conf_mutex);
 }
 
Signature · 1 line
1.7.9.5
Applied
#1 lore raw

PATCH 1/1 ath10k: remove stale peers upon vif removal

Quoted 6 lines · Michal Kazior

Fixes leak of ath10k_peer structures if FW stops responding suddenly and we unload the driver (e.g. eject the device while we're associated and unload the driver).

Thanks, applied.

Signature · 1 line
Kalle Valo