Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2342c5f authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann
Browse files

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: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 92594a51
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -125,6 +125,9 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
			goto done;
			goto done;
	}
	}


	bacpy(&chan->src, &la.l2_bdaddr);
	chan->src_type = la.l2_bdaddr_type;

	if (la.l2_cid)
	if (la.l2_cid)
		err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));
		err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));
	else
	else
@@ -156,9 +159,6 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
		break;
		break;
	}
	}


	bacpy(&chan->src, &la.l2_bdaddr);
	chan->src_type = la.l2_bdaddr_type;

	if (chan->psm && bdaddr_type_is_le(chan->src_type))
	if (chan->psm && bdaddr_type_is_le(chan->src_type))
		chan->mode = L2CAP_MODE_LE_FLOWCTL;
		chan->mode = L2CAP_MODE_LE_FLOWCTL;