summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2011-08-05 10:51:26 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-08-11 19:50:28 -0300
commite9d5cb541b22aa651edc29990092ec5f8174cd39 (patch)
tree9a58b39ec75a59c5c1442548afd9ee91081db9b2 /net
parent7176522cdca1f0b78a1434b41761f0334511822a (diff)
downloadlinux-3.10-e9d5cb541b22aa651edc29990092ec5f8174cd39.tar.gz
linux-3.10-e9d5cb541b22aa651edc29990092ec5f8174cd39.tar.bz2
linux-3.10-e9d5cb541b22aa651edc29990092ec5f8174cd39.zip
Bluetooth: hidp: Fix session cleanup on failed conn add
Once the session thread is running, cleanup must be handled by the session thread only. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hidp/core.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 43b4c2deb7c..7e19a012970 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -1044,8 +1044,12 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
}
err = hid_add_device(session->hid);
- if (err < 0)
- goto err_add_device;
+ if (err < 0) {
+ atomic_inc(&session->terminate);
+ wake_up_process(session->task);
+ up_write(&hidp_session_sem);
+ return err;
+ }
if (session->input) {
hidp_send_ctrl_message(session,
@@ -1059,12 +1063,6 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
up_write(&hidp_session_sem);
return 0;
-err_add_device:
- hid_destroy_device(session->hid);
- session->hid = NULL;
- atomic_inc(&session->terminate);
- wake_up_process(session->task);
-
unlink:
hidp_del_timer(session);