Merge "Bluetooth: bnep: Fix deadlock in session deletion" into msm-3.0
This commit is contained in:
committed by
QuIC Gerrit Code Review
commit
1671f939a5
@@ -155,6 +155,7 @@ struct bnep_session {
|
||||
unsigned int role;
|
||||
unsigned long state;
|
||||
unsigned long flags;
|
||||
atomic_t terminate;
|
||||
struct task_struct *task;
|
||||
|
||||
struct ethhdr eh;
|
||||
|
||||
@@ -484,9 +484,11 @@ static int bnep_session(void *arg)
|
||||
|
||||
init_waitqueue_entry(&wait, current);
|
||||
add_wait_queue(sk_sleep(sk), &wait);
|
||||
while (!kthread_should_stop()) {
|
||||
while (1) {
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
|
||||
if (atomic_read(&s->terminate))
|
||||
break;
|
||||
/* RX */
|
||||
while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
|
||||
skb_orphan(skb);
|
||||
@@ -643,9 +645,10 @@ int bnep_del_connection(struct bnep_conndel_req *req)
|
||||
down_read(&bnep_session_sem);
|
||||
|
||||
s = __bnep_get_session(req->dst);
|
||||
if (s)
|
||||
kthread_stop(s->task);
|
||||
else
|
||||
if (s) {
|
||||
atomic_inc(&s->terminate);
|
||||
wake_up_process(s->task);
|
||||
} else
|
||||
err = -ENOENT;
|
||||
|
||||
up_read(&bnep_session_sem);
|
||||
|
||||
Reference in New Issue
Block a user