Skip to content

Commit 199a81a

Browse files
Vasyl Vavrychukgregkh
authored andcommitted
mac80211_hwsim: Timer should be initialized before device registered
commit a1881c9 upstream. 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] Cc: [email protected] Signed-off-by: Vasyl Vavrychuk <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4794d94 commit 199a81a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,6 +2698,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
26982698

26992699
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
27002700

2701+
tasklet_hrtimer_init(&data->beacon_timer,
2702+
mac80211_hwsim_beacon,
2703+
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
2704+
27012705
err = ieee80211_register_hw(hw);
27022706
if (err < 0) {
27032707
printk(KERN_DEBUG "mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
@@ -2722,10 +2726,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
27222726
data->debugfs,
27232727
data, &hwsim_simulate_radar);
27242728

2725-
tasklet_hrtimer_init(&data->beacon_timer,
2726-
mac80211_hwsim_beacon,
2727-
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
2728-
27292729
spin_lock_bh(&hwsim_radio_lock);
27302730
list_add_tail(&data->list, &hwsim_radios);
27312731
spin_unlock_bh(&hwsim_radio_lock);

0 commit comments

Comments
 (0)