linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] iwlwifi: fix warnings produced by kernel debug options
@ 2021-11-10 21:57 Lukasz Bartosik
  2021-11-12  9:29 ` Coelho, Luciano
  2021-11-22 18:38 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Bartosik @ 2021-11-10 21:57 UTC (permalink / raw)
  To: Luca Coelho; +Cc: linux-wireless, Johannes Berg, upstream

From: Łukasz Bartosik <lb@semihalf.com>

Fix warnings produced by:
- lockdep_assert_wiphy() in function reg_process_self_managed_hint(),
- wiphy_dereference() in function iwl_mvm_init_fw_regd().
Both function are expected to be called in critical section.

The warnings were discovered when running v5.15 kernel
with debug options enabled:

1)
Hardware name: Google Delbin/Delbin
RIP: 0010:reg_process_self_managed_hint+0x254/0x347 [cfg80211]
...
Call Trace:
regulatory_set_wiphy_regd_sync+0x3d/0xb0
iwl_mvm_init_mcc+0x49d/0x5a2
iwl_op_mode_mvm_start+0x1b58/0x2507
? iwl_mvm_reprobe_wk+0x94/0x94
_iwl_op_mode_start+0x146/0x1a3
iwl_opmode_register+0xda/0x13d
init_module+0x28/0x1000

2)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:263 suspicious rcu_dereference_protected() usage!
...
Hardware name: Google Delbin/Delbin, BIOS Google_Delbin
Call Trace:
dump_stack_lvl+0xb1/0xe6
iwl_mvm_init_fw_regd+0x2e7/0x379
iwl_mvm_init_mcc+0x2c6/0x5a2
iwl_op_mode_mvm_start+0x1b58/0x2507
? iwl_mvm_reprobe_wk+0x94/0x94
_iwl_op_mode_start+0x146/0x1a3
iwl_opmode_register+0xda/0x13d
init_module+0x28/0x100

Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
Signed-off-by: Łukasz Bartosik <lb@semihalf.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 77ea2d0a3091..61dd75f9304d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -687,6 +687,7 @@ static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm)
 	int ret;
 
 	rtnl_lock();
+	wiphy_lock(mvm->hw->wiphy);
 	mutex_lock(&mvm->mutex);
 
 	ret = iwl_run_init_mvm_ucode(mvm);
@@ -702,6 +703,7 @@ static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm)
 		iwl_mvm_stop_device(mvm);
 
 	mutex_unlock(&mvm->mutex);
+	wiphy_unlock(mvm->hw->wiphy);
 	rtnl_unlock();
 
 	if (ret < 0)
-- 
2.34.0.rc0.344.g81b53c2807-goog


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

* Re: [PATCH v1] iwlwifi: fix warnings produced by kernel debug options
  2021-11-10 21:57 [PATCH v1] iwlwifi: fix warnings produced by kernel debug options Lukasz Bartosik
@ 2021-11-12  9:29 ` Coelho, Luciano
  2021-11-22 18:38 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Coelho, Luciano @ 2021-11-12  9:29 UTC (permalink / raw)
  To: lb; +Cc: linux-wireless, Berg, Johannes, upstream

On Wed, 2021-11-10 at 22:57 +0100, Lukasz Bartosik wrote:
> From: Łukasz Bartosik <lb@semihalf.com>
> 
> Fix warnings produced by:
> - lockdep_assert_wiphy() in function reg_process_self_managed_hint(),
> - wiphy_dereference() in function iwl_mvm_init_fw_regd().
> Both function are expected to be called in critical section.
> 
> The warnings were discovered when running v5.15 kernel
> with debug options enabled:
> 
> 1)
> Hardware name: Google Delbin/Delbin
> RIP: 0010:reg_process_self_managed_hint+0x254/0x347 [cfg80211]
> ...
> Call Trace:
> regulatory_set_wiphy_regd_sync+0x3d/0xb0
> iwl_mvm_init_mcc+0x49d/0x5a2
> iwl_op_mode_mvm_start+0x1b58/0x2507
> ? iwl_mvm_reprobe_wk+0x94/0x94
> _iwl_op_mode_start+0x146/0x1a3
> iwl_opmode_register+0xda/0x13d
> init_module+0x28/0x1000
> 
> 2)
> drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:263 suspicious rcu_dereference_protected() usage!
> ...
> Hardware name: Google Delbin/Delbin, BIOS Google_Delbin
> Call Trace:
> dump_stack_lvl+0xb1/0xe6
> iwl_mvm_init_fw_regd+0x2e7/0x379
> iwl_mvm_init_mcc+0x2c6/0x5a2
> iwl_op_mode_mvm_start+0x1b58/0x2507
> ? iwl_mvm_reprobe_wk+0x94/0x94
> _iwl_op_mode_start+0x146/0x1a3
> iwl_opmode_register+0xda/0x13d
> init_module+0x28/0x100
> 
> Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
> Signed-off-by: Łukasz Bartosik <lb@semihalf.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
> index 77ea2d0a3091..61dd75f9304d 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
> @@ -687,6 +687,7 @@ static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm)
>  	int ret;
>  
>  	rtnl_lock();
> +	wiphy_lock(mvm->hw->wiphy);
>  	mutex_lock(&mvm->mutex);
>  
>  	ret = iwl_run_init_mvm_ucode(mvm);
> @@ -702,6 +703,7 @@ static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm)
>  		iwl_mvm_stop_device(mvm);
>  
>  	mutex_unlock(&mvm->mutex);
> +	wiphy_unlock(mvm->hw->wiphy);
>  	rtnl_unlock();
>  
>  	if (ret < 0)

Thanks! This somehow got lost when rebasing stuff from our internal
tree.

Kalle, assigning to you.  Can you please add a Cc: stable tag?

--
Cheers,
Luca.

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

* Re: [PATCH v1] iwlwifi: fix warnings produced by kernel debug options
  2021-11-10 21:57 [PATCH v1] iwlwifi: fix warnings produced by kernel debug options Lukasz Bartosik
  2021-11-12  9:29 ` Coelho, Luciano
@ 2021-11-22 18:38 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-11-22 18:38 UTC (permalink / raw)
  To: Lukasz Bartosik; +Cc: Luca Coelho, linux-wireless, Johannes Berg, upstream

Lukasz Bartosik <lb@semihalf.com> wrote:

> From: Łukasz Bartosik <lb@semihalf.com>
> 
> Fix warnings produced by:
> - lockdep_assert_wiphy() in function reg_process_self_managed_hint(),
> - wiphy_dereference() in function iwl_mvm_init_fw_regd().
> Both function are expected to be called in critical section.
> 
> The warnings were discovered when running v5.15 kernel
> with debug options enabled:
> 
> 1)
> Hardware name: Google Delbin/Delbin
> RIP: 0010:reg_process_self_managed_hint+0x254/0x347 [cfg80211]
> ...
> Call Trace:
> regulatory_set_wiphy_regd_sync+0x3d/0xb0
> iwl_mvm_init_mcc+0x49d/0x5a2
> iwl_op_mode_mvm_start+0x1b58/0x2507
> ? iwl_mvm_reprobe_wk+0x94/0x94
> _iwl_op_mode_start+0x146/0x1a3
> iwl_opmode_register+0xda/0x13d
> init_module+0x28/0x1000
> 
> 2)
> drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:263 suspicious rcu_dereference_protected() usage!
> ...
> Hardware name: Google Delbin/Delbin, BIOS Google_Delbin
> Call Trace:
> dump_stack_lvl+0xb1/0xe6
> iwl_mvm_init_fw_regd+0x2e7/0x379
> iwl_mvm_init_mcc+0x2c6/0x5a2
> iwl_op_mode_mvm_start+0x1b58/0x2507
> ? iwl_mvm_reprobe_wk+0x94/0x94
> _iwl_op_mode_start+0x146/0x1a3
> iwl_opmode_register+0xda/0x13d
> init_module+0x28/0x100
> 
> Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
> Signed-off-by: Łukasz Bartosik <lb@semihalf.com>

Patch applied to wireless-drivers.git, thanks.

f5cecf1d4c5f iwlwifi: fix warnings produced by kernel debug options

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20211110215744.5487-1-lukasz.bartosik@semihalf.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2021-11-22 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 21:57 [PATCH v1] iwlwifi: fix warnings produced by kernel debug options Lukasz Bartosik
2021-11-12  9:29 ` Coelho, Luciano
2021-11-22 18:38 ` 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).