aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_sock.c
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-10-21 12:21:39 -0400
committerMarcel Holtmann <marcel@holtmann.org>2013-10-21 15:58:17 -0400
commitacdcabf532908fbefbea294fcad2e3989d1dc036 (patch)
tree96498c6e4b766277d643621891cacdf3ecb6d346 /net/bluetooth/l2cap_sock.c
parent0f2c6153746f270cf28559aa81a4da27847bd395 (diff)
Bluetooth: Hold socket in defer callback in L2CAP socket
In both places that we use the defer callback the socket lock is held for a indirect sk access inside __l2cap_change_state() and chan->ops->defer(), all the rest of the code between lock_sock() and release_sock() is already protected by the channel lock and won't be affected by this change. We now use l2cap_change_state(), the locked version of the change state function, and the defer callback does the locking itself now. This does not affect other uses of the defer callback. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r--net/bluetooth/l2cap_sock.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index a0b31db1246e..e55999228c8a 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1195,11 +1195,15 @@ static void l2cap_sock_ready_cb(struct l2cap_chan *chan)
1195 1195
1196static void l2cap_sock_defer_cb(struct l2cap_chan *chan) 1196static void l2cap_sock_defer_cb(struct l2cap_chan *chan)
1197{ 1197{
1198 struct sock *sk = chan->data; 1198 struct sock *parent, *sk = chan->data;
1199 struct sock *parent = bt_sk(sk)->parent; 1199
1200 lock_sock(sk);
1200 1201
1202 parent = bt_sk(sk)->parent;
1201 if (parent) 1203 if (parent)
1202 parent->sk_data_ready(parent, 0); 1204 parent->sk_data_ready(parent, 0);
1205
1206 release_sock(sk);
1203} 1207}
1204 1208
1205static void l2cap_sock_resume_cb(struct l2cap_chan *chan) 1209static void l2cap_sock_resume_cb(struct l2cap_chan *chan)