d80211: fix softlockup in hw_scan card when rmmod
Subsystems (2)
PATCH 1/1 d80211: fix softlockup in hw_scan card when rmmod
The local->scan_work.data is not clear after scan is completed.
This will cause softlockup when removing driver module because the local->scan_work is not initialized for hw_scan card
and we are trying to cancel the scan_work with an uninitialized timer_list.
net/d80211/ieee80211.c +0 -0
net/d80211/ieee80211_sta.c +1 -0
@@ -3641,6 +3641,7 @@ void ieee80211_scan_completed(struct ieeprintk (KERN_DEBUG "%s: scan completed\n" , dev->name);spin_lock_bh (&local->ifsta_data_lock); local->sta_scanning =0 ; + local->scan_work.data =NULL ; local->last_scan_completed = jiffies;spin_unlock_bh (&local->ifsta_data_lock);
Quoted 5 lines · Hong Liu
The
local->scan_work.datais not clear after scan is completed.This will cause softlockup when removing driver module because the
local->scan_workis not initialized forhw_scancard
and we are trying to cancel thescan_workwith an uninitializedtimer_list.
I think this is a better fix:
---
Subject: [PATCH] d80211: do not cancel uninitialized work
When ops->hw_scan is set, scan_work is never initialized thus canceling it causes weird problems.
--- net/d80211/ieee80211.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
net/d80211/ieee80211.c +3 -2
@@ -2082,7 +2082,8 @@ void ieee80211_if_shutdown(struct net_decase IEEE80211_IF_TYPE_IBSS : sdata->u.sta.state =IEEE80211_DISABLED ;cancel_delayed_work (&sdata->u.sta.work); -if (local->scan_work.data == sdata->dev) { +if (!local->ops->hw_scan && + local->scan_work.data == sdata->dev) { local->sta_scanning =0 ;cancel_delayed_work (&local->scan_work);flush_scheduled_work ();
@@ -4660,7 +4661,7 @@ void ieee80211_unregister_hw(struct ieeeif (local->stat_time)del_timer_sync (&local->stat_timer); -if (local->scan_work.data) { +if (!local->ops->hw_scan && local->scan_work.data) { local->sta_scanning =0 ;cancel_delayed_work (&local->scan_work);flush_scheduled_work ();
Thanks,
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs