Bluetooth: Fix BT_SECURITY socket option for fixed channels (ATT)
authorJohan Hedberg <johan.hedberg@intel.com>
Sat, 25 Jan 2014 22:10:07 +0000 (17:10 -0500)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 13 Feb 2014 07:51:37 +0000 (09:51 +0200)
The BT_SECURITY option should also be allowed for fixed channels, so
punch the appropriate hole for it when checking for the channel type.
The main user of fixed CID user space sockets is right now ATT (which is
broken without this patch).

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

index 04abd26a346684d87010bae7f5f606bf81c47474..7ad346ea06ed047cc4d0da1ca43c980eba43dcc3 100644 (file)
@@ -513,6 +513,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
        switch (optname) {
        case BT_SECURITY:
                if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
+                   chan->chan_type != L2CAP_CHAN_FIXED &&
                    chan->chan_type != L2CAP_CHAN_RAW) {
                        err = -EINVAL;
                        break;
@@ -769,6 +770,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
        switch (optname) {
        case BT_SECURITY:
                if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
+                   chan->chan_type != L2CAP_CHAN_FIXED &&
                    chan->chan_type != L2CAP_CHAN_RAW) {
                        err = -EINVAL;
                        break;