]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.1.5/p54spi-fix-workqueue-deadlock.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.1.5 / p54spi-fix-workqueue-deadlock.patch
CommitLineData
b468d7f8
GKH
1From 2d1618170eb493d18f66f2ac03775409a6fb97c6 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Michael=20B=C3=BCsch?= <m@bues.ch>
3Date: Wed, 16 Nov 2011 23:55:46 +0100
4Subject: p54spi: Fix workqueue deadlock
5
6From: =?UTF-8?q?Michael=20B=C3=BCsch?= <m@bues.ch>
7
8commit 2d1618170eb493d18f66f2ac03775409a6fb97c6 upstream.
9
10priv->work must not be synced while priv->mutex is locked, because
11the mutex is taken in the work handler.
12Move cancel_work_sync down to after the device shutdown code.
13This is safe, because the work handler checks fw_state and bails out
14early in case of a race.
15
16Signed-off-by: Michael Buesch <m@bues.ch>
17Acked-by: Christian Lamparter <chunkeey@googlemail.com>
18Signed-off-by: John W. Linville <linville@tuxdriver.com>
19Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
20
21---
22 drivers/net/wireless/p54/p54spi.c | 4 ++--
23 1 file changed, 2 insertions(+), 2 deletions(-)
24
25--- a/drivers/net/wireless/p54/p54spi.c
26+++ b/drivers/net/wireless/p54/p54spi.c
27@@ -589,8 +589,6 @@ static void p54spi_op_stop(struct ieee80
28
29 WARN_ON(priv->fw_state != FW_STATE_READY);
30
31- cancel_work_sync(&priv->work);
32-
33 p54spi_power_off(priv);
34 spin_lock_irqsave(&priv->tx_lock, flags);
35 INIT_LIST_HEAD(&priv->tx_pending);
36@@ -598,6 +596,8 @@ static void p54spi_op_stop(struct ieee80
37
38 priv->fw_state = FW_STATE_OFF;
39 mutex_unlock(&priv->mutex);
40+
41+ cancel_work_sync(&priv->work);
42 }
43
44 static int __devinit p54spi_probe(struct spi_device *spi)