aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2015-01-01 03:13:39 -0500
committerMarcel Holtmann <marcel@holtmann.org>2015-01-06 10:19:35 -0500
commit8b324fa6915bf4ad7d28e58a5a004f16e470e58d (patch)
tree44f0802f8ecc5397d4462065357cb06be6e63630 /drivers/bluetooth
parent661cf88acd84875c275820ed01e42b25c4e9a1e2 (diff)
Bluetooth: btmrvl: fix race issue while stopping main thread
btmrvl_remove_card() calls kthread_stop() to stop the main thread, but kthread_should_stop() is checked when all the activities are done in the main thread before sleeping. We will have kthread_should_stop() check as soon as main thread is woken up. This fixes a crash issue caused due to an invalid memory access while unnecessarily processing interrupts after card removal. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btmrvl_main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 30939c993d94..e3f5711c6690 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -616,6 +616,11 @@ static int btmrvl_service_main_thread(void *data)
616 616
617 BT_DBG("main_thread woke up"); 617 BT_DBG("main_thread woke up");
618 618
619 if (kthread_should_stop()) {
620 BT_DBG("main_thread: break from main thread");
621 break;
622 }
623
619 spin_lock_irqsave(&priv->driver_lock, flags); 624 spin_lock_irqsave(&priv->driver_lock, flags);
620 if (adapter->int_count) { 625 if (adapter->int_count) {
621 adapter->int_count = 0; 626 adapter->int_count = 0;