* [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band migration
@ 2023-02-09 22:26 Christian Marangi
2023-02-20 8:57 ` Kalle Valo
2023-02-22 10:10 ` Kalle Valo
0 siblings, 2 replies; 5+ messages in thread
From: Christian Marangi @ 2023-02-09 22:26 UTC (permalink / raw)
To: Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Christian Marangi, ath11k, linux-wireless, netdev,
linux-kernel
Cc: Dan Carpenter
Fix sleep in atomic context warning detected by Smatch static checker
analyzer.
Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex
always even if sta is not transitioning to another band.
This is peer_add function and a more secure locking should not cause
performance regression.
Fixes: d673cb6fe6c0 ("wifi: ath11k: fix peer addition/deletion error on sta band migration")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/wireless/ath/ath11k/peer.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/peer.c b/drivers/net/wireless/ath/ath11k/peer.c
index 1ae7af02c364..1380811827a8 100644
--- a/drivers/net/wireless/ath/ath11k/peer.c
+++ b/drivers/net/wireless/ath/ath11k/peer.c
@@ -382,22 +382,23 @@ int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif,
return -ENOBUFS;
}
+ mutex_lock(&ar->ab->tbl_mtx_lock);
spin_lock_bh(&ar->ab->base_lock);
peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr);
if (peer) {
if (peer->vdev_id == param->vdev_id) {
spin_unlock_bh(&ar->ab->base_lock);
+ mutex_unlock(&ar->ab->tbl_mtx_lock);
return -EINVAL;
}
/* Assume sta is transitioning to another band.
* Remove here the peer from rhash.
*/
- mutex_lock(&ar->ab->tbl_mtx_lock);
ath11k_peer_rhash_delete(ar->ab, peer);
- mutex_unlock(&ar->ab->tbl_mtx_lock);
}
spin_unlock_bh(&ar->ab->base_lock);
+ mutex_unlock(&ar->ab->tbl_mtx_lock);
ret = ath11k_wmi_send_peer_create_cmd(ar, param);
if (ret) {
--
2.38.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band migration
2023-02-09 22:26 [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band migration Christian Marangi
@ 2023-02-20 8:57 ` Kalle Valo
2023-02-20 13:51 ` Christian Marangi
2023-02-22 10:10 ` Kalle Valo
1 sibling, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2023-02-20 8:57 UTC (permalink / raw)
To: Christian Marangi
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Christian Marangi, ath11k, linux-wireless, netdev, linux-kernel,
Dan Carpenter
Christian Marangi <ansuelsmth@gmail.com> wrote:
> Fix sleep in atomic context warning detected by Smatch static checker
> analyzer.
>
> Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex
> always even if sta is not transitioning to another band.
> This is peer_add function and a more secure locking should not cause
> performance regression.
>
> Fixes: d673cb6fe6c0 ("wifi: ath11k: fix peer addition/deletion error on sta band migration")
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
I assume you only compile tested this and I'll add that to the commit log. It's
always good to know how the patch was tested.
--
https://patchwork.kernel.org/project/linux-wireless/patch/20230209222622.1751-1-ansuelsmth@gmail.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band migration
2023-02-20 8:57 ` Kalle Valo
@ 2023-02-20 13:51 ` Christian Marangi
2023-02-22 10:07 ` Kalle Valo
0 siblings, 1 reply; 5+ messages in thread
From: Christian Marangi @ 2023-02-20 13:51 UTC (permalink / raw)
To: Kalle Valo
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
ath11k, linux-wireless, netdev, linux-kernel, Dan Carpenter
On Mon, Feb 20, 2023 at 08:57:51AM +0000, Kalle Valo wrote:
> Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> > Fix sleep in atomic context warning detected by Smatch static checker
> > analyzer.
> >
> > Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex
> > always even if sta is not transitioning to another band.
> > This is peer_add function and a more secure locking should not cause
> > performance regression.
> >
> > Fixes: d673cb6fe6c0 ("wifi: ath11k: fix peer addition/deletion error on sta band migration")
> > Reported-by: Dan Carpenter <error27@gmail.com>
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
>
> I assume you only compile tested this and I'll add that to the commit log. It's
> always good to know how the patch was tested.
>
Hi, I just got time to test this and works correctly on my Xiaomi
AX3600.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
--
Ansuel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band migration
2023-02-20 13:51 ` Christian Marangi
@ 2023-02-22 10:07 ` Kalle Valo
0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2023-02-22 10:07 UTC (permalink / raw)
To: Christian Marangi
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
ath11k, linux-wireless, netdev, linux-kernel, Dan Carpenter
Christian Marangi <ansuelsmth@gmail.com> writes:
> On Mon, Feb 20, 2023 at 08:57:51AM +0000, Kalle Valo wrote:
>> Christian Marangi <ansuelsmth@gmail.com> wrote:
>>
>> > Fix sleep in atomic context warning detected by Smatch static checker
>> > analyzer.
>> >
>> > Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex
>> > always even if sta is not transitioning to another band.
>> > This is peer_add function and a more secure locking should not cause
>> > performance regression.
>> >
>> > Fixes: d673cb6fe6c0 ("wifi: ath11k: fix peer addition/deletion
>> > error on sta band migration")
>> > Reported-by: Dan Carpenter <error27@gmail.com>
>> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
>> > Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
>>
>> I assume you only compile tested this and I'll add that to the commit log. It's
>> always good to know how the patch was tested.
>>
>
> Hi, I just got time to test this and works correctly on my Xiaomi
> AX3600.
>
> Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
Thanks, I'll add this to the commit log.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band migration
2023-02-09 22:26 [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band migration Christian Marangi
2023-02-20 8:57 ` Kalle Valo
@ 2023-02-22 10:10 ` Kalle Valo
1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2023-02-22 10:10 UTC (permalink / raw)
To: Christian Marangi
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Christian Marangi, ath11k, linux-wireless, netdev, linux-kernel,
Dan Carpenter
Christian Marangi <ansuelsmth@gmail.com> wrote:
> Fix sleep in atomic context warning detected by Smatch static checker
> analyzer.
>
> Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex
> always even if sta is not transitioning to another band.
> This is peer_add function and a more secure locking should not cause
> performance regression.
>
> Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
>
> Fixes: d673cb6fe6c0 ("wifi: ath11k: fix peer addition/deletion error on sta band migration")
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Patch applied to ath-next branch of ath.git, thanks.
60b7d62ba8cd wifi: ath11k: fix SAC bug on peer addition with sta band migration
--
https://patchwork.kernel.org/project/linux-wireless/patch/20230209222622.1751-1-ansuelsmth@gmail.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-22 10:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-09 22:26 [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band migration Christian Marangi
2023-02-20 8:57 ` Kalle Valo
2023-02-20 13:51 ` Christian Marangi
2023-02-22 10:07 ` Kalle Valo
2023-02-22 10:10 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).