]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
Bluetooth: cmtp: Fix session cleanup on failed conn add
authorPeter Hurley <peter@hurleysoftware.com>
Fri, 5 Aug 2011 14:53:52 +0000 (10:53 -0400)
committerGustavo F. Padovan <padovan@profusion.mobi>
Thu, 11 Aug 2011 22:50:28 +0000 (19:50 -0300)
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>
net/bluetooth/cmtp/core.c

index 42cb2f4c0db1ede11c4a87187d685f8b1265a15c..521baa4fe835eb775f24e59dda205ae76d1f87ce 100644 (file)
@@ -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);