netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped
       [not found] <20220720011730.1025099-1-sashal@kernel.org>
@ 2022-07-20  1:17 ` Sasha Levin
  2022-07-20  1:58   ` Ben Greear
  2022-07-20  1:17 ` [PATCH AUTOSEL 5.4 07/16] wifi: cfg80211: Allow P2P client interface to indicate port authorization Sasha Levin
  1 sibling, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2022-07-20  1:17 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Felix Fietkau, Toke Høiland-Jørgensen, Johannes Berg,
	Sasha Levin, johannes, davem, edumazet, kuba, pabeni,
	linux-wireless, netdev

From: Felix Fietkau <nbd@nbd.name>

[ Upstream commit f856373e2f31ffd340e47e2b00027bd4070f74b3 ]

When a vif is being removed and sdata->bss is cleared, __ieee80211_wake_txqs
can still be called on it, which crashes as soon as sdata->bss is being
dereferenced.
To fix this properly, check for SDATA_STATE_RUNNING before waking queues,
and take the fq lock when setting it (to ensure that __ieee80211_wake_txqs
observes the change when running on a different CPU)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@kernel.org>
Link: https://lore.kernel.org/r/20220531190824.60019-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mac80211/iface.c | 2 ++
 net/mac80211/util.c  | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index ddc001ad9055..48bda8aaa90a 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -803,7 +803,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
 	bool cancel_scan;
 	struct cfg80211_nan_func *func;
 
+	spin_lock_bh(&local->fq.lock);
 	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
+	spin_unlock_bh(&local->fq.lock);
 
 	cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata;
 	if (cancel_scan)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index c1c117fdf318..8ae0186091b6 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -250,6 +250,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
 	local_bh_disable();
 	spin_lock(&fq->lock);
 
+	if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))
+		goto out;
+
 	if (sdata->vif.type == NL80211_IFTYPE_AP)
 		ps = &sdata->bss->ps;
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH AUTOSEL 5.4 07/16] wifi: cfg80211: Allow P2P client interface to indicate port authorization
       [not found] <20220720011730.1025099-1-sashal@kernel.org>
  2022-07-20  1:17 ` [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped Sasha Levin
@ 2022-07-20  1:17 ` Sasha Levin
  1 sibling, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2022-07-20  1:17 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vinayak Yadawad, Johannes Berg, Sasha Levin, johannes, davem,
	edumazet, kuba, pabeni, linux-wireless, netdev

From: Vinayak Yadawad <vinayak.yadawad@broadcom.com>

[ Upstream commit 8d70f33ed7207e82e51d5a4436c8ba2268a83b14 ]

In case of 4way handshake offload, cfg80211_port_authorized
enables driver to indicate successful 4way handshake to cfg80211 layer.
Currently this path of port authorization is restricted to
interface type NL80211_IFTYPE_STATION. This patch extends
the use of port authorization API for P2P client as well.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
Link: https://lore.kernel.org/r/ef25cb49fcb921df2e5d99e574f65e8a009cc52c.1655905440.git.vinayak.yadawad@broadcom.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/wireless/sme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 63f89687a018..b70d7e8fbc12 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -1032,7 +1032,8 @@ void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid)
 {
 	ASSERT_WDEV_LOCK(wdev);
 
-	if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
+	if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION &&
+		    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
 		return;
 
 	if (WARN_ON(!wdev->current_bss) ||
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped
  2022-07-20  1:17 ` [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped Sasha Levin
@ 2022-07-20  1:58   ` Ben Greear
  2022-07-20  5:50     ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Greear @ 2022-07-20  1:58 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable
  Cc: Felix Fietkau, Toke Høiland-Jørgensen, Johannes Berg,
	johannes, davem, edumazet, kuba, pabeni, linux-wireless, netdev

I think this one had a regression and needs another init-lock-early patch to keep from causing
problems?

It certainly broke my 5.17-ish kernel...

Thanks,
Ben

On 7/19/22 6:17 PM, Sasha Levin wrote:
> From: Felix Fietkau <nbd@nbd.name>
> 
> [ Upstream commit f856373e2f31ffd340e47e2b00027bd4070f74b3 ]
> 
> When a vif is being removed and sdata->bss is cleared, __ieee80211_wake_txqs
> can still be called on it, which crashes as soon as sdata->bss is being
> dereferenced.
> To fix this properly, check for SDATA_STATE_RUNNING before waking queues,
> and take the fq lock when setting it (to ensure that __ieee80211_wake_txqs
> observes the change when running on a different CPU)
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> Acked-by: Toke Høiland-Jørgensen <toke@kernel.org>
> Link: https://lore.kernel.org/r/20220531190824.60019-1-nbd@nbd.name
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   net/mac80211/iface.c | 2 ++
>   net/mac80211/util.c  | 3 +++
>   2 files changed, 5 insertions(+)
> 
> diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
> index ddc001ad9055..48bda8aaa90a 100644
> --- a/net/mac80211/iface.c
> +++ b/net/mac80211/iface.c
> @@ -803,7 +803,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
>   	bool cancel_scan;
>   	struct cfg80211_nan_func *func;
>   
> +	spin_lock_bh(&local->fq.lock);
>   	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
> +	spin_unlock_bh(&local->fq.lock);
>   
>   	cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata;
>   	if (cancel_scan)
> diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> index c1c117fdf318..8ae0186091b6 100644
> --- a/net/mac80211/util.c
> +++ b/net/mac80211/util.c
> @@ -250,6 +250,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
>   	local_bh_disable();
>   	spin_lock(&fq->lock);
>   
> +	if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))
> +		goto out;
> +
>   	if (sdata->vif.type == NL80211_IFTYPE_AP)
>   		ps = &sdata->bss->ps;
>   
> 


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped
  2022-07-20  1:58   ` Ben Greear
@ 2022-07-20  5:50     ` Johannes Berg
  2022-09-09 18:48       ` Ben Greear
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2022-07-20  5:50 UTC (permalink / raw)
  To: Ben Greear, Sasha Levin, linux-kernel, stable
  Cc: Felix Fietkau, Toke Høiland-Jørgensen, davem, edumazet,
	kuba, pabeni, linux-wireless, netdev

On Tue, 2022-07-19 at 18:58 -0700, Ben Greear wrote:
> I think this one had a regression and needs another init-lock-early patch to keep from causing
> problems?
> 

Yes, for now we should drop it from all stable trees. We'll re-assess
the situation later if it's needed there or not, I guess.

johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped
  2022-07-20  5:50     ` Johannes Berg
@ 2022-09-09 18:48       ` Ben Greear
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Greear @ 2022-09-09 18:48 UTC (permalink / raw)
  To: Johannes Berg, Sasha Levin, linux-kernel, stable
  Cc: Felix Fietkau, Toke Høiland-Jørgensen, davem, edumazet,
	kuba, pabeni, linux-wireless, netdev

On 7/19/22 10:50 PM, Johannes Berg wrote:
> On Tue, 2022-07-19 at 18:58 -0700, Ben Greear wrote:
>> I think this one had a regression and needs another init-lock-early patch to keep from causing
>> problems?
>>
> 
> Yes, for now we should drop it from all stable trees. We'll re-assess
> the situation later if it's needed there or not, I guess.
> 
> johannes
> 

I think there is a second problem with this patch:

If I create multiple station vdevs (on mtk7916 radio, not sure that matters much or not),
and admin up a few of them, but leave remainder down, then the queues on the originally-down-vdevs
are never started and so tx-path-hang on those stations.

I am not sure the best way to fix this.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-09 20:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220720011730.1025099-1-sashal@kernel.org>
2022-07-20  1:17 ` [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped Sasha Levin
2022-07-20  1:58   ` Ben Greear
2022-07-20  5:50     ` Johannes Berg
2022-09-09 18:48       ` Ben Greear
2022-07-20  1:17 ` [PATCH AUTOSEL 5.4 07/16] wifi: cfg80211: Allow P2P client interface to indicate port authorization Sasha Levin

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).