Commit e04cafbc authored by Michal Kazior's avatar Michal Kazior Committed by Kalle Valo

ath10k: fix peer limit enforcement

Firmware peer entries are involved in internal
firmware vdev structures. This was not accounted
for and could lead firmware to crash due to asking
it to do more than it could.

Fixes: 039a0051 ("ath10k: allocate fw resources for iface combinations")
Signed-off-by: default avatarMichal Kazior <>
Signed-off-by: default avatarKalle Valo <>
parent adaeed74
......@@ -598,11 +598,19 @@ ath10k_mac_get_any_chandef_iter(struct ieee80211_hw *hw,
static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr,
enum wmi_peer_type peer_type)
struct ath10k_vif *arvif;
int num_peers = 0;
int ret;
if (ar->num_peers >= ar->max_num_peers)
num_peers = ar->num_peers;
/* Each vdev consumes a peer entry as well */
list_for_each_entry(arvif, &ar->arvifs, list)
if (num_peers >= ar->max_num_peers)
return -ENOBUFS;
ret = ath10k_wmi_peer_create(ar, vdev_id, addr, peer_type);
......@@ -4112,6 +4120,11 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
if (ar->num_peers >= ar->max_num_peers) {
ath10k_warn(ar, "refusing vdev creation due to insufficient peer entry resources in firmware\n");
return -ENOBUFS;
if (ar->free_vdev_map == 0) {
ath10k_warn(ar, "Free vdev map is empty, no more interfaces allowed.\n");
ret = -EBUSY;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment