]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Bluetooth: Socket address parameter for CID is in little endian
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 16 Oct 2013 16:31:17 +0000 (09:31 -0700)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 16 Oct 2013 16:52:51 +0000 (19:52 +0300)
The L2CAP socket parameter for CID are actually provided in little
endian. So convert our constants into little endian before comparing
them.

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

index 95498d553b0098a58994cf0dc63c8e6f30c2b941..34e5a58ffca87df4df67d57b8f3df77ed69c92ce 100644 (file)
@@ -77,7 +77,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
                if (la.l2_psm)
                        return -EINVAL;
                /* We only allow ATT user space socket */
-               if (la.l2_cid != L2CAP_CID_ATT)
+               if (la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
                        return -EINVAL;
        }
 
@@ -170,7 +170,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
                if (la.l2_psm)
                        return -EINVAL;
                /* We only allow ATT user space socket */
-               if (la.l2_cid != L2CAP_CID_ATT)
+               if (la.l2_cid != __constant_cpu_to_le16(L2CAP_CID_ATT))
                        return -EINVAL;
        }