]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Bluetooth: Allow 3D profile to use security mode 4 level 0
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 12 Oct 2013 14:19:32 +0000 (07:19 -0700)
committerJohan Hedberg <johan.hedberg@intel.com>
Sat, 12 Oct 2013 14:30:42 +0000 (17:30 +0300)
The PSM 0x0021 is dedicated to the 3D profile and has permission to
use security mode 4 level 0 for L2CAP connectionless unicast data
transfers.

When establishing a L2CAP connectionless channel on PSM 0x0021, it
will no longer force Secure Simple Pairing.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/l2cap.h
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_sock.c

index f141b5f6e4f17c9447df0d1c93b1775109f7322c..12523c79eb3bd3b0591efb8be5754872dd66ea2d 100644 (file)
@@ -237,6 +237,7 @@ struct l2cap_conn_rsp {
 /* protocol/service multiplexer (PSM) */
 #define L2CAP_PSM_SDP          0x0001
 #define L2CAP_PSM_RFCOMM       0x0003
+#define L2CAP_PSM_3DSP         0x0021
 
 /* channel indentifier */
 #define L2CAP_CID_SIGNALING    0x0001
index cc51cb860c4050578bf5050c40a7edd879ce5b7a..e932ffda5445f72f265e1dae90d90a86f5054d1b 100644 (file)
@@ -688,6 +688,16 @@ static inline u8 l2cap_get_auth_type(struct l2cap_chan *chan)
                        return HCI_AT_NO_BONDING;
                }
                break;
+       case L2CAP_CHAN_CONN_LESS:
+               if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_3DSP)) {
+                       if (chan->sec_level == BT_SECURITY_LOW)
+                               chan->sec_level = BT_SECURITY_SDP;
+               }
+               if (chan->sec_level == BT_SECURITY_HIGH)
+                       return HCI_AT_NO_BONDING_MITM;
+               else
+                       return HCI_AT_NO_BONDING;
+               break;
        case L2CAP_CHAN_CONN_ORIENTED:
                if (chan->psm == __constant_cpu_to_le16(L2CAP_PSM_SDP)) {
                        if (chan->sec_level == BT_SECURITY_LOW)
index bee98ebfae4d9c0324ca77cca685708f12ef14a6..bd6fe7fd27371da8afd5c96c9c4f14255073a656 100644 (file)
@@ -101,6 +101,10 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
                goto done;
 
        switch (chan->chan_type) {
+       case L2CAP_CHAN_CONN_LESS:
+               if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_3DSP)
+                       chan->sec_level = BT_SECURITY_SDP;
+               break;
        case L2CAP_CHAN_CONN_ORIENTED:
                if (__le16_to_cpu(la.l2_psm) == L2CAP_PSM_SDP ||
                    __le16_to_cpu(la.l2_psm) == L2CAP_PSM_RFCOMM)