Bluetooth: Clean up socket locking in l2cap_sock_recvmsg
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 25 Sep 2013 10:26:05 +0000 (13:26 +0300)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 25 Sep 2013 17:30:10 +0000 (14:30 -0300)
This patch cleans up the locking login in l2cap_sock_recvmsg by pairing
up each lock_sock call with a release_sock call. The function already
has a "done" label that handles releasing the socket and returning from
the function so the fix is rather simple.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
net/bluetooth/l2cap_sock.c

index ad95b42..c85537c 100644 (file)
@@ -805,8 +805,8 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
                pi->chan->state = BT_CONFIG;
 
                __l2cap_connect_rsp_defer(pi->chan);
-               release_sock(sk);
-               return 0;
+               err = 0;
+               goto done;
        }
 
        release_sock(sk);