diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2016-01-26 22:19:11 (GMT) |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2016-01-29 10:47:24 (GMT) |
commit | a2342c5fe5f2810b8ef6a0826bd584aa709dd2c6 (patch) | |
tree | 5f83f8fd0aca1810950959d31c1e37f96dce4f0c | |
parent | 92594a51120ebc6c2f556204fc73568c8f7cb0f4 (diff) | |
download | linux-a2342c5fe5f2810b8ef6a0826bd584aa709dd2c6.tar.xz |
Bluetooth: L2CAP: Fix setting chan src info before adding PSM/CID
At least the l2cap_add_psm() routine depends on the source address
type being properly set to know what auto-allocation ranges to use, so
the assignment to l2cap_chan needs to happen before this.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index f401592..e4cae72 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -125,6 +125,9 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) goto done; } + bacpy(&chan->src, &la.l2_bdaddr); + chan->src_type = la.l2_bdaddr_type; + if (la.l2_cid) err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid)); else @@ -156,9 +159,6 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) break; } - bacpy(&chan->src, &la.l2_bdaddr); - chan->src_type = la.l2_bdaddr_type; - if (chan->psm && bdaddr_type_is_le(chan->src_type)) chan->mode = L2CAP_MODE_LE_FLOWCTL; |