aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_sock.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-04-18 18:36:44 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-05-05 12:47:41 -0400
commit73b2ec18532f45e9028ce4c7bc8d7f8818eabd2a (patch)
treee4ec31e6f06d1e84ad4eff0f6ee2a5f7e004a1b8 /net/bluetooth/l2cap_sock.c
parent9e4425fff9e0a0fb6a8c705777ed861f991f8747 (diff)
Bluetooth: Handle psm == 0 case inside l2cap_add_psm()
When the user doesn't specify a psm we have the choose one for the channel. Now we do this inside l2cap_add_psm(). Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r--net/bluetooth/l2cap_sock.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 2156dcecec0b..aca99cd5377d 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -256,28 +256,6 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
256 goto done; 256 goto done;
257 } 257 }
258 258
259 if (!chan->psm && !chan->scid) {
260 bdaddr_t *src = &bt_sk(sk)->src;
261 u16 psm;
262
263 err = -EINVAL;
264
265 write_lock_bh(&l2cap_sk_list.lock);
266
267 for (psm = 0x1001; psm < 0x1100; psm += 2)
268 if (!__l2cap_get_sock_by_addr(cpu_to_le16(psm), src)) {
269 chan->psm = cpu_to_le16(psm);
270 chan->sport = cpu_to_le16(psm);
271 err = 0;
272 break;
273 }
274
275 write_unlock_bh(&l2cap_sk_list.lock);
276
277 if (err < 0)
278 goto done;
279 }
280
281 sk->sk_max_ack_backlog = backlog; 259 sk->sk_max_ack_backlog = backlog;
282 sk->sk_ack_backlog = 0; 260 sk->sk_ack_backlog = 0;
283 sk->sk_state = BT_LISTEN; 261 sk->sk_state = BT_LISTEN;