Bluetooth: Check that remote supports A2MP before creating channel
Before attempting to create a channel directly on an AMP check
that the remote device supports A2MP signalling before starting
the physical link creation process.
Change-Id: Iac2bcebf9630368685e24e636e39ffa82651705d
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index c21eb88..7ca920e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -738,8 +738,10 @@
if (l2cap_check_security(sk) && __l2cap_no_conn_pending(sk)) {
l2cap_pi(sk)->conf_state |= L2CAP_CONF_CONNECT_PEND;
- if (l2cap_pi(sk)->amp_pref == BT_AMP_POLICY_PREFER_AMP)
- amp_create_physical(l2cap_pi(sk)->conn, sk);
+ if (l2cap_pi(sk)->amp_pref ==
+ BT_AMP_POLICY_PREFER_AMP &&
+ conn->fc_mask & L2CAP_FC_A2MP)
+ amp_create_physical(conn, sk);
else
l2cap_send_conn_req(sk);
}
@@ -843,8 +845,10 @@
l2cap_pi(sk)->conf_state |= L2CAP_CONF_CONNECT_PEND;
- if (l2cap_pi(sk)->amp_pref == BT_AMP_POLICY_PREFER_AMP)
- amp_create_physical(l2cap_pi(sk)->conn, sk);
+ if (l2cap_pi(sk)->amp_pref ==
+ BT_AMP_POLICY_PREFER_AMP &&
+ conn->fc_mask & L2CAP_FC_A2MP)
+ amp_create_physical(conn, sk);
else
l2cap_send_conn_req(sk);