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

ath10k: don't remove peer that doesn't exist

If peer creation failed during offchannel Tx the
driver attempted to delete the peer nonetheless.
This caused the ar->num_peers counter to be
incorrectly decremented. This subsequently could
cause the counter to drop below 0 and also
eventually lead to firmware crash because host
would think there are less peer entries created in
firmware then there really were.
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 6f7429c2
...@@ -3335,6 +3335,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) ...@@ -3335,6 +3335,7 @@ void ath10k_offchan_tx_work(struct work_struct *work)
int vdev_id; int vdev_id;
int ret; int ret;
unsigned long time_left; unsigned long time_left;
bool tmp_peer_created = false;
/* FW requirement: We must create a peer before FW will send out /* FW requirement: We must create a peer before FW will send out
* an offchannel frame. Otherwise the frame will be stuck and * an offchannel frame. Otherwise the frame will be stuck and
...@@ -3372,6 +3373,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) ...@@ -3372,6 +3373,7 @@ void ath10k_offchan_tx_work(struct work_struct *work)
if (ret) if (ret)
ath10k_warn(ar, "failed to create peer %pM on vdev %d: %d\n", ath10k_warn(ar, "failed to create peer %pM on vdev %d: %d\n",
peer_addr, vdev_id, ret); peer_addr, vdev_id, ret);
tmp_peer_created = (ret == 0);
} }
spin_lock_bh(&ar->data_lock); spin_lock_bh(&ar->data_lock);
...@@ -3387,7 +3389,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) ...@@ -3387,7 +3389,7 @@ void ath10k_offchan_tx_work(struct work_struct *work)
ath10k_warn(ar, "timed out waiting for offchannel skb %p\n", ath10k_warn(ar, "timed out waiting for offchannel skb %p\n",
skb); skb);
if (!peer) { if (!peer && tmp_peer_created) {
ret = ath10k_peer_delete(ar, vdev_id, peer_addr); ret = ath10k_peer_delete(ar, vdev_id, peer_addr);
if (ret) if (ret)
ath10k_warn(ar, "failed to delete peer %pM on vdev %d: %d\n", ath10k_warn(ar, "failed to delete peer %pM on vdev %d: %d\n",
......
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