diff options
Diffstat (limited to 'net/bluetooth/af_bluetooth.c')
-rw-r--r-- | net/bluetooth/af_bluetooth.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 744ed3f07ef3..02b9baa1930b 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -41,14 +41,13 @@ | |||
41 | 41 | ||
42 | #include <net/bluetooth/bluetooth.h> | 42 | #include <net/bluetooth/bluetooth.h> |
43 | 43 | ||
44 | #define VERSION "2.14" | 44 | #define VERSION "2.15" |
45 | 45 | ||
46 | /* Bluetooth sockets */ | 46 | /* Bluetooth sockets */ |
47 | #define BT_MAX_PROTO 8 | 47 | #define BT_MAX_PROTO 8 |
48 | static struct net_proto_family *bt_proto[BT_MAX_PROTO]; | 48 | static struct net_proto_family *bt_proto[BT_MAX_PROTO]; |
49 | static DEFINE_RWLOCK(bt_proto_lock); | 49 | static DEFINE_RWLOCK(bt_proto_lock); |
50 | 50 | ||
51 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
52 | static struct lock_class_key bt_lock_key[BT_MAX_PROTO]; | 51 | static struct lock_class_key bt_lock_key[BT_MAX_PROTO]; |
53 | static const char *bt_key_strings[BT_MAX_PROTO] = { | 52 | static const char *bt_key_strings[BT_MAX_PROTO] = { |
54 | "sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP", | 53 | "sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP", |
@@ -86,11 +85,6 @@ static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) | |||
86 | bt_slock_key_strings[proto], &bt_slock_key[proto], | 85 | bt_slock_key_strings[proto], &bt_slock_key[proto], |
87 | bt_key_strings[proto], &bt_lock_key[proto]); | 86 | bt_key_strings[proto], &bt_lock_key[proto]); |
88 | } | 87 | } |
89 | #else | ||
90 | static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) | ||
91 | { | ||
92 | } | ||
93 | #endif | ||
94 | 88 | ||
95 | int bt_sock_register(int proto, struct net_proto_family *ops) | 89 | int bt_sock_register(int proto, struct net_proto_family *ops) |
96 | { | 90 | { |
@@ -217,7 +211,8 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock) | |||
217 | continue; | 211 | continue; |
218 | } | 212 | } |
219 | 213 | ||
220 | if (sk->sk_state == BT_CONNECTED || !newsock) { | 214 | if (sk->sk_state == BT_CONNECTED || !newsock || |
215 | bt_sk(parent)->defer_setup) { | ||
221 | bt_accept_unlink(sk); | 216 | bt_accept_unlink(sk); |
222 | if (newsock) | 217 | if (newsock) |
223 | sock_graft(sk, newsock); | 218 | sock_graft(sk, newsock); |
@@ -232,7 +227,7 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock) | |||
232 | EXPORT_SYMBOL(bt_accept_dequeue); | 227 | EXPORT_SYMBOL(bt_accept_dequeue); |
233 | 228 | ||
234 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | 229 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
235 | struct msghdr *msg, size_t len, int flags) | 230 | struct msghdr *msg, size_t len, int flags) |
236 | { | 231 | { |
237 | int noblock = flags & MSG_DONTWAIT; | 232 | int noblock = flags & MSG_DONTWAIT; |
238 | struct sock *sk = sock->sk; | 233 | struct sock *sk = sock->sk; |
@@ -277,7 +272,9 @@ static inline unsigned int bt_accept_poll(struct sock *parent) | |||
277 | 272 | ||
278 | list_for_each_safe(p, n, &bt_sk(parent)->accept_q) { | 273 | list_for_each_safe(p, n, &bt_sk(parent)->accept_q) { |
279 | sk = (struct sock *) list_entry(p, struct bt_sock, accept_q); | 274 | sk = (struct sock *) list_entry(p, struct bt_sock, accept_q); |
280 | if (sk->sk_state == BT_CONNECTED) | 275 | if (sk->sk_state == BT_CONNECTED || |
276 | (bt_sk(parent)->defer_setup && | ||
277 | sk->sk_state == BT_CONNECT2)) | ||
281 | return POLLIN | POLLRDNORM; | 278 | return POLLIN | POLLRDNORM; |
282 | } | 279 | } |
283 | 280 | ||