Skip to content

Commit

Permalink
ar9170: fix hang on stop
Browse files Browse the repository at this point in the history
This patch fixes a locking problem which freezes the network core.

The deadlock goes as follows:
- ar9170_op_stop - is called
1. change the state to IDLE
2. > take the MUTEX <
3. cancel_SYNC all pending work, which means
    "block until a work_struct's callback has terminated"
=>  if filter_config_work was queued it tries to get the MUTEX,
       before checking the device state...

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Christian Lamparter authored and John W. Linville committed Apr 22, 2009
1 parent 807e373 commit 32c1628
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/wireless/ar9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,9 @@ static void ar9170_op_stop(struct ieee80211_hw *hw)
if (IS_STARTED(ar))
ar->state = AR9170_IDLE;

mutex_lock(&ar->mutex);
flush_workqueue(ar->hw->workqueue);

mutex_lock(&ar->mutex);
cancel_delayed_work_sync(&ar->tx_status_janitor);
cancel_work_sync(&ar->filter_config_work);
cancel_work_sync(&ar->beacon_work);
Expand Down Expand Up @@ -1123,10 +1124,10 @@ static void ar9170_set_filters(struct work_struct *work)
filter_config_work);
int err;

mutex_lock(&ar->mutex);
if (unlikely(!IS_STARTED(ar)))
goto unlock;
return ;

mutex_lock(&ar->mutex);
if (ar->filter_changed & AR9170_FILTER_CHANGED_PROMISC) {
err = ar9170_set_operating_mode(ar);
if (err)
Expand Down

0 comments on commit 32c1628

Please sign in to comment.