Skip to content

Commit a2342c5

Browse files
Johan Hedbergholtmann
authored andcommitted
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>
1 parent 92594a5 commit a2342c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/bluetooth/l2cap_sock.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
125125
goto done;
126126
}
127127

128+
bacpy(&chan->src, &la.l2_bdaddr);
129+
chan->src_type = la.l2_bdaddr_type;
130+
128131
if (la.l2_cid)
129132
err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));
130133
else
@@ -156,9 +159,6 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
156159
break;
157160
}
158161

159-
bacpy(&chan->src, &la.l2_bdaddr);
160-
chan->src_type = la.l2_bdaddr_type;
161-
162162
if (chan->psm && bdaddr_type_is_le(chan->src_type))
163163
chan->mode = L2CAP_MODE_LE_FLOWCTL;
164164

0 commit comments

Comments
 (0)