Skip to content

Commit

Permalink
Bluetooth: hidp: Fix session cleanup on failed conn add
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Hurley authored and Gustavo F. Padovan committed Aug 11, 2011
1 parent 7176522 commit e9d5cb5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);

Expand Down

0 comments on commit e9d5cb5

Please sign in to comment.