Skip to content

Commit

Permalink
Bluetooth: cmtp: 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
peterhurley authored and Gustavo F. Padovan committed Aug 11, 2011
1 parent ff062ea commit 687beaa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions net/bluetooth/cmtp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,17 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock)

if (!(session->flags & (1 << CMTP_LOOPBACK))) {
err = cmtp_attach_device(session);
if (err < 0)
goto detach;
if (err < 0) {
atomic_inc(&session->terminate);
wake_up_process(session->task);
up_write(&cmtp_session_sem);
return err;
}
}

up_write(&cmtp_session_sem);
return 0;

detach:
cmtp_detach_device(session);

unlink:
__cmtp_unlink_session(session);

Expand Down

0 comments on commit 687beaa

Please sign in to comment.