Skip to contentSkip to conversation

Bluetooth: Ignore A2MP data on non-BR/EDR links

PATCH In review [email protected] 3 participants 6 messages Oct 16, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Bluetooth: Ignore A2MP data on non-BR/EDR links

From: Johan Hedberg <[email protected]>

The A2MP CID is only valid for BR/EDR transports. We should ignore A2MP data on non-BR/EDR links and refuse to create an amp_mgr object.

---
 net/bluetooth/a2mp.c | 3 +++
 1 file changed, 3 insertions(+)
net/bluetooth/a2mp.c +3 -0
index fe32a33..efcd108 100644
@@ -836,6 +836,9 @@ struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
 {
 	struct amp_mgr *mgr;
 
+	if (conn->hcon->type != ACL_LINK)
+		return NULL;
+
 	mgr = amp_mgr_create(conn, false);
 	if (!mgr) {
 		BT_ERR("Could not create AMP manager");
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/2 Bluetooth: Ignore SMP data on non-LE links

From: Johan Hedberg <[email protected]>

The SMP CID is only defined for LE transports. Instead of returning an error from smp_sig_channel() in this case (which would cause a disconnection) just return 0 to ignore the data, which is consistent with the behavior for other unknown CIDs.

---
 net/bluetooth/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/smp.c +1 -1
index 463e50c..fc200e0 100644
@@ -856,7 +856,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
 
 	if (hcon->type != LE_LINK) {
 		kfree_skb(skb);
-		return -ENOTSUPP;
+		return 0;
 	}
 
 	if (skb->len < 1) {
Signature · 1 line
1.8.3.1
maintainer
#2 lore raw

Re: [PATCH 2/2] Bluetooth: Ignore SMP data on non-LE links

Hi Johan,

Quoted 9 lines

The SMP CID is only defined for LE transports. Instead of returning an error from smp_sig_channel() in this case (which would cause a disconnection) just return 0 to ignore the data, which is consistent with the behavior for other unknown CIDs.

---
net/bluetooth/smp.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

#4 lore raw
In reply to [email protected]

Hi Johan,

Quoted 15 lines · On Wed, Oct 16, 2013 at 11:37:00AM +0300, [email protected] wrote:

From: Johan Hedberg <[email protected]>

The A2MP CID is only valid for BR/EDR transports. We should ignore A2MP data on non-BR/EDR links and refuse to create an amp_mgr object.

---
 net/bluetooth/a2mp.c | 3 +++
 1 file changed, 3 insertions(+)
net/bluetooth/a2mp.c +0 -0
index fe32a33..efcd108 100644

net/bluetooth/a2mp.c struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn, · line 841

Quoted 6 lines
net/bluetooth/a2mp.c +3 -0
@@ -836,6 +836,9 @@ struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
 {
 	struct amp_mgr *mgr;
 
+	if (conn->hcon->type != ACL_LINK)
+		return NULL;
+

Have you experienced this ever happened?

Best regards
Andrei Emeltchenko

maintainer
#5 lore raw

Hi Andrei,

Quoted 16 lines
Quoted 16 lines

The A2MP CID is only valid for BR/EDR transports. We should ignore A2MP data on non-BR/EDR links and refuse to create an amp_mgr object.

---
net/bluetooth/a2mp.c | 3 +++

1 file changed, 3 insertions(+)
net/bluetooth/a2mp.c +0 -0
index fe32a33..efcd108 100644
@@ -836,6 +836,9 @@ struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
 {
 	struct amp_mgr *mgr;
 
Quoted 5 lines

net/bluetooth/a2mp.c struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn, · line 841

Quoted 3 lines
net/bluetooth/a2mp.c +3 -0
+	if (conn->hcon->type != ACL_LINK)
+		return NULL;
+

Have you experienced this ever happened?

this is how good software is written. You check that your input is valid first. Otherwise you open yourself up to vulnerabilities.

Regards

Marcel