diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2011-08-05 16:53:52 +0200 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-08-12 00:50:28 +0200 |
commit | 687beaa0d1d937c327e2f97b4b4fa6c23ca70624 (patch) | |
tree | 157353f922d5505df1971ad7c9deeaf34fb05f52 /net/bluetooth/cmtp | |
parent | Bluetooth: hidp: Don't release device ref if never held (diff) | |
download | linux-687beaa0d1d937c327e2f97b4b4fa6c23ca70624.tar.xz linux-687beaa0d1d937c327e2f97b4b4fa6c23ca70624.zip |
Bluetooth: cmtp: 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/bluetooth/cmtp')
-rw-r--r-- | net/bluetooth/cmtp/core.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 42cb2f4c0db1..521baa4fe835 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -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); |