[Spice-devel] [PATCH usbredir 4/8] Have each thread signal it's death.
Jeremy White
jwhite at codeweavers.com
Wed Dec 9 14:16:04 PST 2015
This prevents a kernel panic when removing a module
at exactly the right time.
Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
kernel/rx.c | 4 ++++
kernel/tx.c | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/kernel/rx.c b/kernel/rx.c
index 92ffa97..16d87af 100644
--- a/kernel/rx.c
+++ b/kernel/rx.c
@@ -33,6 +33,10 @@ int usbredir_rx_loop(void *data)
pr_debug("%s exit\n", __func__);
+ spin_lock(&udev->lock);
+ udev->rx = NULL;
+ spin_unlock(&udev->lock);
+
usbredir_device_disconnect(udev);
usbredir_device_deallocate(udev, false, true);
diff --git a/kernel/tx.c b/kernel/tx.c
index 10e5e62..f509781 100644
--- a/kernel/tx.c
+++ b/kernel/tx.c
@@ -144,6 +144,11 @@ int usbredir_tx_loop(void *data)
}
pr_debug("%s exit\n", __func__);
+
+ spin_lock(&udev->lock);
+ udev->tx = NULL;
+ spin_unlock(&udev->lock);
+
usbredir_device_disconnect(udev);
usbredir_device_deallocate(udev, true, false);
--
2.1.4
More information about the Spice-devel
mailing list