Skip to content

Commit a1881c9

Browse files
Vasyl Vavrychukjmberg-intel
authored andcommitted
mac80211_hwsim: Timer should be initialized before device registered
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]>
1 parent 33483a6 commit a1881c9

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
@@ -2884,6 +2884,10 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
28842884

28852885
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
28862886

2887+
tasklet_hrtimer_init(&data->beacon_timer,
2888+
mac80211_hwsim_beacon,
2889+
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
2890+
28872891
err = ieee80211_register_hw(hw);
28882892
if (err < 0) {
28892893
pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
@@ -2908,10 +2912,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
29082912
data->debugfs,
29092913
data, &hwsim_simulate_radar);
29102914

2911-
tasklet_hrtimer_init(&data->beacon_timer,
2912-
mac80211_hwsim_beacon,
2913-
CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
2914-
29152915
spin_lock_bh(&hwsim_radio_lock);
29162916
err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
29172917
hwsim_rht_params);

0 commit comments

Comments
 (0)