]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.88/mac80211_hwsim-timer-should-be-initialized-before-device-registered.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.88 / mac80211_hwsim-timer-should-be-initialized-before-device-registered.patch
1 From a1881c9b8a1edef0a5ae1d5c1b61406fe3402114 Mon Sep 17 00:00:00 2001
2 From: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
3 Date: Thu, 18 Oct 2018 01:02:12 +0300
4 Subject: mac80211_hwsim: Timer should be initialized before device registered
5
6 From: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
7
8 commit a1881c9b8a1edef0a5ae1d5c1b61406fe3402114 upstream.
9
10 Otherwise if network manager starts configuring Wi-Fi interface
11 immidiatelly after getting notification of its creation, we will get
12 NULL pointer dereference:
13
14 BUG: unable to handle kernel NULL pointer dereference at (null)
15 IP: [<ffffffff95ae94c8>] hrtimer_active+0x28/0x50
16 ...
17 Call Trace:
18 [<ffffffff95ae9997>] ? hrtimer_try_to_cancel+0x27/0x110
19 [<ffffffff95ae9a95>] ? hrtimer_cancel+0x15/0x20
20 [<ffffffffc0803bf0>] ? mac80211_hwsim_config+0x140/0x1c0 [mac80211_hwsim]
21
22 Cc: stable@vger.kernel.org
23 Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
24 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 drivers/net/wireless/mac80211_hwsim.c | 8 ++++----
29 1 file changed, 4 insertions(+), 4 deletions(-)
30
31 --- a/drivers/net/wireless/mac80211_hwsim.c
32 +++ b/drivers/net/wireless/mac80211_hwsim.c
33 @@ -2698,6 +2698,10 @@ static int mac80211_hwsim_new_radio(stru
34
35 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
36
37 + tasklet_hrtimer_init(&data->beacon_timer,
38 + mac80211_hwsim_beacon,
39 + CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
40 +
41 err = ieee80211_register_hw(hw);
42 if (err < 0) {
43 printk(KERN_DEBUG "mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
44 @@ -2722,10 +2726,6 @@ static int mac80211_hwsim_new_radio(stru
45 data->debugfs,
46 data, &hwsim_simulate_radar);
47
48 - tasklet_hrtimer_init(&data->beacon_timer,
49 - mac80211_hwsim_beacon,
50 - CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
51 -
52 spin_lock_bh(&hwsim_radio_lock);
53 list_add_tail(&data->list, &hwsim_radios);
54 spin_unlock_bh(&hwsim_radio_lock);