summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hidp/hidp.h
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2011-06-30 13:53:53 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-06-30 15:47:50 -0300
commit7bb59df83b190817f56c4e2fec3078d99d906ad4 (patch)
tree371add6842b2620dbedad6d4d240681f09118fe8 /net/bluetooth/hidp/hidp.h
parent7ac28817536797fd40e9646452183606f9e17f71 (diff)
downloadlinux-7bb59df83b190817f56c4e2fec3078d99d906ad4.tar.gz
linux-7bb59df83b190817f56c4e2fec3078d99d906ad4.tar.bz2
linux-7bb59df83b190817f56c4e2fec3078d99d906ad4.zip
Bluetooth: Fix hidp disconnect deadlocks and lost wakeup
Partial revert of commit aabf6f89. When the hidp session thread was converted from kernel_thread to kthread, the atomic/wakeups were replaced with kthread_stop. kthread_stop has blocking semantics which are inappropriate for the hidp session kthread. In addition, the kthread signals itself to terminate in hidp_process_hid_control() - it cannot do this with kthread_stop(). Lastly, a wakeup can be lost if the wakeup happens between checking for the loop exit condition and setting the current state to TASK_INTERRUPTIBLE. (Without appropriate synchronization mechanisms, the task state should not be changed between the condition test and the yield - via schedule() - as this creates a race between the wakeup and resetting the state back to interruptible.) Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hidp/hidp.h')
-rw-r--r--net/bluetooth/hidp/hidp.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/bluetooth/hidp/hidp.h b/net/bluetooth/hidp/hidp.h
index 19e95004b286..af1bcc823f26 100644
--- a/net/bluetooth/hidp/hidp.h
+++ b/net/bluetooth/hidp/hidp.h
@@ -142,6 +142,7 @@ struct hidp_session {
uint ctrl_mtu;
uint intr_mtu;
+ atomic_t terminate;
struct task_struct *task;
unsigned char keys[8];