Skip to content

Commit

Permalink
p54spi: Fix workqueue deadlock
Browse files Browse the repository at this point in the history
priv->work must not be synced while priv->mutex is locked, because
the mutex is taken in the work handler.
Move cancel_work_sync down to after the device shutdown code.
This is safe, because the work handler checks fw_state and bails out
early in case of a race.

Signed-off-by: Michael Buesch <m@bues.ch>
Cc: <stable@vger.kernel.org>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Michael Büsch authored and John W. Linville committed Nov 17, 2011
1 parent 32d3a39 commit 2d16181
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/p54/p54spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,15 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)

WARN_ON(priv->fw_state != FW_STATE_READY);

cancel_work_sync(&priv->work);

p54spi_power_off(priv);
spin_lock_irqsave(&priv->tx_lock, flags);
INIT_LIST_HEAD(&priv->tx_pending);
spin_unlock_irqrestore(&priv->tx_lock, flags);

priv->fw_state = FW_STATE_OFF;
mutex_unlock(&priv->mutex);

cancel_work_sync(&priv->work);
}

static int __devinit p54spi_probe(struct spi_device *spi)
Expand Down

0 comments on commit 2d16181

Please sign in to comment.