linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211_hwsim: Timer should be initialized before device registered
@ 2018-10-17 22:02 Vasyl Vavrychuk
  2018-11-15 10:08 ` Vasyl Vavrychuk
  0 siblings, 1 reply; 3+ messages in thread
From: Vasyl Vavrychuk @ 2018-10-17 22:02 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Vasyl Vavrychuk

From: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>

Otherwise if network manager starts configuring Wi-Fi interface
immidiatelly after getting notification of its creation, we will get
NULL pointer dereference:

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: [<ffffffff95ae94c8>] hrtimer_active+0x28/0x50
  ...
  Call Trace:
   [<ffffffff95ae9997>] ? hrtimer_try_to_cancel+0x27/0x110
   [<ffffffff95ae9a95>] ? hrtimer_cancel+0x15/0x20
   [<ffffffffc0803bf0>] ? mac80211_hwsim_config+0x140/0x1c0 [mac80211_hwsim]

Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
---
 drivers/net/wireless/mac80211_hwsim.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 1068757ec42e..d0e0a9f5bf98 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2890,6 +2890,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
 
 	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
 
+	tasklet_hrtimer_init(&data->beacon_timer,
+			     mac80211_hwsim_beacon,
+			     CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
+
 	err = ieee80211_register_hw(hw);
 	if (err < 0) {
 		pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
@@ -2914,10 +2918,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
 				    data->debugfs,
 				    data, &hwsim_simulate_radar);
 
-	tasklet_hrtimer_init(&data->beacon_timer,
-			     mac80211_hwsim_beacon,
-			     CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-
 	spin_lock_bh(&hwsim_radio_lock);
 	err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
 				     hwsim_rht_params);
-- 
2.19.1


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

* Re: [PATCH] mac80211_hwsim: Timer should be initialized before device registered
  2018-10-17 22:02 [PATCH] mac80211_hwsim: Timer should be initialized before device registered Vasyl Vavrychuk
@ 2018-11-15 10:08 ` Vasyl Vavrychuk
  2018-11-15 11:14   ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Vasyl Vavrychuk @ 2018-11-15 10:08 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless, Kalle Valo, David S. Miller

Does anyone have some feedback about this?

On Thu, Oct 18, 2018 at 1:02 AM Vasyl Vavrychuk
<vasyl.vavrychuk@globallogic.com> wrote:
>
> From: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
>
> Otherwise if network manager starts configuring Wi-Fi interface
> immidiatelly after getting notification of its creation, we will get
> NULL pointer dereference:
>
>   BUG: unable to handle kernel NULL pointer dereference at           (null)
>   IP: [<ffffffff95ae94c8>] hrtimer_active+0x28/0x50
>   ...
>   Call Trace:
>    [<ffffffff95ae9997>] ? hrtimer_try_to_cancel+0x27/0x110
>    [<ffffffff95ae9a95>] ? hrtimer_cancel+0x15/0x20
>    [<ffffffffc0803bf0>] ? mac80211_hwsim_config+0x140/0x1c0 [mac80211_hwsim]
>
> Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
> ---
>  drivers/net/wireless/mac80211_hwsim.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
> index 1068757ec42e..d0e0a9f5bf98 100644
> --- a/drivers/net/wireless/mac80211_hwsim.c
> +++ b/drivers/net/wireless/mac80211_hwsim.c
> @@ -2890,6 +2890,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
>
>         wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
>
> +       tasklet_hrtimer_init(&data->beacon_timer,
> +                            mac80211_hwsim_beacon,
> +                            CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
> +
>         err = ieee80211_register_hw(hw);
>         if (err < 0) {
>                 pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
> @@ -2914,10 +2918,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
>                                     data->debugfs,
>                                     data, &hwsim_simulate_radar);
>
> -       tasklet_hrtimer_init(&data->beacon_timer,
> -                            mac80211_hwsim_beacon,
> -                            CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
> -
>         spin_lock_bh(&hwsim_radio_lock);
>         err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
>                                      hwsim_rht_params);
> --
> 2.19.1
>


-- 
Vasyl Vavrychuk  | Software Engineer
GlobalLogic L'viv
Skype: vasyl.vavrychuk
www.globallogic.com

http://www.globallogic.com/email_disclaimer.txt

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

* Re: [PATCH] mac80211_hwsim: Timer should be initialized before device registered
  2018-11-15 10:08 ` Vasyl Vavrychuk
@ 2018-11-15 11:14   ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2018-11-15 11:14 UTC (permalink / raw)
  To: Vasyl Vavrychuk; +Cc: Johannes Berg, linux-wireless, David S. Miller

(fixing top posting)

Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com> writes:

> On Thu, Oct 18, 2018 at 1:02 AM Vasyl Vavrychuk
> <vasyl.vavrychuk@globallogic.com> wrote:
>>
>> From: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
>>
>> Otherwise if network manager starts configuring Wi-Fi interface
>> immidiatelly after getting notification of its creation, we will get
>> NULL pointer dereference:
>>
>>   BUG: unable to handle kernel NULL pointer dereference at           (null)
>>   IP: [<ffffffff95ae94c8>] hrtimer_active+0x28/0x50
>>   ...
>>   Call Trace:
>>    [<ffffffff95ae9997>] ? hrtimer_try_to_cancel+0x27/0x110
>>    [<ffffffff95ae9a95>] ? hrtimer_cancel+0x15/0x20
>>    [<ffffffffc0803bf0>] ? mac80211_hwsim_config+0x140/0x1c0 [mac80211_hwsim]
>>
>> Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
>
> Does anyone have some feedback about this?

Johannes has applied it six days ago:

https://patchwork.kernel.org/patch/10646105/

https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git/commit/?id=a1881c9b8a1edef0a5ae1d5c1b61406fe3402114

To help the maintainers you can check yourself the status from
patchwork:

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

-- 
Kalle Valo

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

end of thread, other threads:[~2018-11-15 11:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17 22:02 [PATCH] mac80211_hwsim: Timer should be initialized before device registered Vasyl Vavrychuk
2018-11-15 10:08 ` Vasyl Vavrychuk
2018-11-15 11:14   ` 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).