Merge "Bluetooth: bnep: Fix deadlock in session deletion" into msm-3.0

This commit is contained in:
Linux Build Service Account
2011-12-08 10:28:10 -08:00
committed by QuIC Gerrit Code Review
2 changed files with 8 additions and 4 deletions

View File

@@ -155,6 +155,7 @@ struct bnep_session {
unsigned int role; unsigned int role;
unsigned long state; unsigned long state;
unsigned long flags; unsigned long flags;
atomic_t terminate;
struct task_struct *task; struct task_struct *task;
struct ethhdr eh; struct ethhdr eh;

View File

@@ -484,9 +484,11 @@ static int bnep_session(void *arg)
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
add_wait_queue(sk_sleep(sk), &wait); add_wait_queue(sk_sleep(sk), &wait);
while (!kthread_should_stop()) { while (1) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (atomic_read(&s->terminate))
break;
/* RX */ /* RX */
while ((skb = skb_dequeue(&sk->sk_receive_queue))) { while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
skb_orphan(skb); skb_orphan(skb);
@@ -643,9 +645,10 @@ int bnep_del_connection(struct bnep_conndel_req *req)
down_read(&bnep_session_sem); down_read(&bnep_session_sem);
s = __bnep_get_session(req->dst); s = __bnep_get_session(req->dst);
if (s) if (s) {
kthread_stop(s->task); atomic_inc(&s->terminate);
else wake_up_process(s->task);
} else
err = -ENOENT; err = -ENOENT;
up_read(&bnep_session_sem); up_read(&bnep_session_sem);