* [PATCH v2] ath10k: Protect ath10k_htt_rx_ring_free with rx_ring.lock
@ 2018-06-14 20:08 ` greearb
0 siblings, 0 replies; 4+ messages in thread
From: greearb @ 2018-06-14 20:08 UTC (permalink / raw)
To: linux-wireless; +Cc: Ben Greear, kvalo, ath10k
From: Ben Greear <greearb@candelatech.com>
While debugging driver crashes related to a buggy firmware
crashing under load, I noticed that ath10k_htt_rx_ring_free
could be called without being under lock. I'm not sure if this
is the root cause of the crash or not, but it seems prudent to
protect it.
Originally tested on 4.16+ kernel with ath10k-ct 10.4 firmware
running on 9984 NIC.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v2: Update description to specify how it was tested.
Generate patch against linux-ath tree (original patch applied with offset)
drivers/net/wireless/ath/ath10k/htt_rx.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index bd23f69..ccd03f8 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -268,11 +268,12 @@ int ath10k_htt_rx_ring_refill(struct ath10k *ar)
spin_lock_bh(&htt->rx_ring.lock);
ret = ath10k_htt_rx_ring_fill_n(htt, (htt->rx_ring.fill_level -
htt->rx_ring.fill_cnt));
- spin_unlock_bh(&htt->rx_ring.lock);
if (ret)
ath10k_htt_rx_ring_free(htt);
+ spin_unlock_bh(&htt->rx_ring.lock);
+
return ret;
}
@@ -284,7 +285,9 @@ void ath10k_htt_rx_free(struct ath10k_htt *htt)
skb_queue_purge(&htt->rx_in_ord_compl_q);
skb_queue_purge(&htt->tx_fetch_ind_q);
+ spin_lock_bh(&htt->rx_ring.lock);
ath10k_htt_rx_ring_free(htt);
+ spin_unlock_bh(&htt->rx_ring.lock);
dma_free_coherent(htt->ar->dev,
ath10k_htt_get_rx_ring_size(htt),
--
2.4.11
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] ath10k: Protect ath10k_htt_rx_ring_free with rx_ring.lock
@ 2018-06-14 20:08 ` greearb
0 siblings, 0 replies; 4+ messages in thread
From: greearb @ 2018-06-14 20:08 UTC (permalink / raw)
To: linux-wireless; +Cc: ath10k, kvalo, Ben Greear
From: Ben Greear <greearb@candelatech.com>
While debugging driver crashes related to a buggy firmware
crashing under load, I noticed that ath10k_htt_rx_ring_free
could be called without being under lock. I'm not sure if this
is the root cause of the crash or not, but it seems prudent to
protect it.
Originally tested on 4.16+ kernel with ath10k-ct 10.4 firmware
running on 9984 NIC.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v2: Update description to specify how it was tested.
Generate patch against linux-ath tree (original patch applied with offset)
drivers/net/wireless/ath/ath10k/htt_rx.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index bd23f69..ccd03f8 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -268,11 +268,12 @@ int ath10k_htt_rx_ring_refill(struct ath10k *ar)
spin_lock_bh(&htt->rx_ring.lock);
ret = ath10k_htt_rx_ring_fill_n(htt, (htt->rx_ring.fill_level -
htt->rx_ring.fill_cnt));
- spin_unlock_bh(&htt->rx_ring.lock);
if (ret)
ath10k_htt_rx_ring_free(htt);
+ spin_unlock_bh(&htt->rx_ring.lock);
+
return ret;
}
@@ -284,7 +285,9 @@ void ath10k_htt_rx_free(struct ath10k_htt *htt)
skb_queue_purge(&htt->rx_in_ord_compl_q);
skb_queue_purge(&htt->tx_fetch_ind_q);
+ spin_lock_bh(&htt->rx_ring.lock);
ath10k_htt_rx_ring_free(htt);
+ spin_unlock_bh(&htt->rx_ring.lock);
dma_free_coherent(htt->ar->dev,
ath10k_htt_get_rx_ring_size(htt),
--
2.4.11
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [v2] ath10k: Protect ath10k_htt_rx_ring_free with rx_ring.lock
2018-06-14 20:08 ` greearb
(?)
(?)
@ 2018-06-28 9:50 ` Kalle Valo
-1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-06-28 9:50 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless, ath10k
Ben Greear <greearb@candelatech.com> wrote:
> While debugging driver crashes related to a buggy firmware
> crashing under load, I noticed that ath10k_htt_rx_ring_free
> could be called without being under lock. I'm not sure if this
> is the root cause of the crash or not, but it seems prudent to
> protect it.
>
> Originally tested on 4.16+ kernel with ath10k-ct 10.4 firmware
> running on 9984 NIC.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
168f75f11fe6 ath10k: protect ath10k_htt_rx_ring_free with rx_ring.lock
--
https://patchwork.kernel.org/patch/10465229/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [v2] ath10k: Protect ath10k_htt_rx_ring_free with rx_ring.lock
2018-06-14 20:08 ` greearb
(?)
@ 2018-06-28 9:50 ` Kalle Valo
-1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-06-28 9:50 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless, ath10k, Ben Greear
Ben Greear <greearb@candelatech.com> wrote:
> While debugging driver crashes related to a buggy firmware
> crashing under load, I noticed that ath10k_htt_rx_ring_free
> could be called without being under lock. I'm not sure if this
> is the root cause of the crash or not, but it seems prudent to
> protect it.
>
> Originally tested on 4.16+ kernel with ath10k-ct 10.4 firmware
> running on 9984 NIC.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
168f75f11fe6 ath10k: protect ath10k_htt_rx_ring_free with rx_ring.lock
--
https://patchwork.kernel.org/patch/10465229/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-06-28 9:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-14 20:08 [PATCH v2] ath10k: Protect ath10k_htt_rx_ring_free with rx_ring.lock greearb
2018-06-14 20:08 ` greearb
2018-06-28 9:50 ` [v2] " Kalle Valo
2018-06-28 9:50 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.