linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix hidp disconnect deadlock
@ 2011-06-25 21:32 Peter Hurley
  2011-06-26  7:16 ` Ilia, Kolominsky
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Hurley @ 2011-06-25 21:32 UTC (permalink / raw)
  To: linux-bluetooth

Release reader lock on r/w sem before stopping khidp thread (which needs to
claim the writer lock on sem before unlinking the session).

NB: kthread_stop waits for thread completion.
---
 net/bluetooth/hidp/core.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index c405a95..16d75d7 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -1096,6 +1096,7 @@ int hidp_del_connection(struct hidp_conndel_req *req)
 {
 	struct hidp_session *session;
 	int err = 0;
+	bool stop_thread = false;
 
 	BT_DBG("");
 
@@ -1111,12 +1112,14 @@ int hidp_del_connection(struct hidp_conndel_req *req)
 			skb_queue_purge(&session->ctrl_transmit);
 			skb_queue_purge(&session->intr_transmit);
 
-			kthread_stop(session->task);
+			stop_thread = true;
 		}
 	} else
 		err = -ENOENT;
 
 	up_read(&hidp_session_sem);
+	if (stop_thread)
+		kthread_stop(session->task);
 	return err;
 }
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-06-30 17:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-25 21:32 [PATCH] Bluetooth: Fix hidp disconnect deadlock Peter Hurley
2011-06-26  7:16 ` Ilia, Kolominsky
2011-06-29 20:24   ` Gustavo F. Padovan
2011-06-29 20:52     ` Gustavo F. Padovan
2011-06-30 14:34       ` Peter Hurley
2011-06-30 14:46         ` gene heskett
2011-06-30 14:55         ` Ilia, Kolominsky
2011-06-30 17:47           ` Gustavo F. Padovan
2011-06-30 17:40         ` Gustavo F. Padovan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).